Code: Select all
:this code uses Random123, which requires NEURON 7.3 or higher
:uses nrnran123.c and nrnran123.h from http://www.neuron.yale.edu/hg/neuron/nrn/file/9d4ab20927bc/src/oc/
VERBATIM
#define VOIDCAST void** vp = (void**)(&(_p_ptr))
extern void * nrnran123_newstream(int,int);
extern void nrnran123_deletestream(void *);
extern double nrnran123_dblpick(void *);
ENDVERBATIM
PROCEDURE setrand(id1,id2) {
VERBATIM
VOIDCAST;
if(*vp) {
nrnran123_deletestream(*vp);
}
*vp = nrnran123_newstream((int) _lid1,(int) _lid2);
ENDVERBATIM
}
FUNCTION pick() {
VERBATIM
VOIDCAST;
_lpick = nrnran123_dblpick(*vp);
ENDVERBATIM
}
Compiling ampa_D2.c
ampa_D2.c:499:15: error: conflicting types for ‘nrnran123_newstream’; have ‘void *(int, int)’
499 | extern void * nrnran123_newstream(int,int);
| ^~~~~~~~~~~~~~~~~~~
In file included from /home/tcgfink/.local/lib/python3.10/site-packages/neuron/.data/include/mech_api.h:15,
from ampa_D2.c:7:
/home/tcgfink/.local/lib/python3.10/site-packages/neuron/.data/include/nrnran123.h:45:25: note: previous declaration of ‘nrnran123_newstream’ with type ‘nrnran123_State *(uint32_t, uint32_t)’ {aka ‘nrnran123_State *(unsigned int, unsigned int)’}
45 | extern nrnran123_State* nrnran123_newstream(uint32_t id1, uint32_t id2);
| ^~~~~~~~~~~~~~~~~~~
ampa_D2.c:500:13: error: conflicting types for ‘nrnran123_deletestream’; have ‘void(void *)’
500 | extern void nrnran123_deletestream(void *);
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/tcgfink/.local/lib/python3.10/site-packages/neuron/.data/include/mech_api.h:15,
from ampa_D2.c:7:
/home/tcgfink/.local/lib/python3.10/site-packages/neuron/.data/include/nrnran123.h:47:13: note: previous declaration of ‘nrnran123_deletestream’ with type ‘void(nrnran123_State *)’
47 | extern void nrnran123_deletestream(nrnran123_State*);
| ^~~~~~~~~~~~~~~~~~~~~~
ampa_D2.c:501:15: error: conflicting types for ‘nrnran123_dblpick’; have ‘double(void *)’
501 | extern double nrnran123_dblpick(void *);
| ^~~~~~~~~~~~~~~~~
In file included from /home/tcgfink/.local/lib/python3.10/site-packages/neuron/.data/include/mech_api.h:15,
from ampa_D2.c:7:
/home/tcgfink/.local/lib/python3.10/site-packages/neuron/.data/include/nrnran123.h:55:15: note: previous declaration of ‘nrnran123_dblpick’ with type ‘double(nrnran123_State *)’
55 | extern double nrnran123_dblpick(nrnran123_State*); /* uniform open interval (0,1)*/
| ^~~~~~~~~~~~~~~~~
make: *** [makemod2c_inc:31: ampa_D2.o] Error 1
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
File "/home/tcgfink/.local/bin/nrnivmodl", line 94, in <module>
subprocess.check_call([exe, *sys.argv[1:]])
File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/tcgfink/.local/lib/python3.10/site-packages/neuron/.data/bin/nrnivmodl']' returned non-zero exit status 2.
Reading the documentation for 8.2, I'm guessing the error is due to Random123 now using C++ rather than C? Whatever the reason, my C and/or C++ skills are too rusty for me to be sure how to fix this. Thank you for the help.