I put all .mod files in a subfolder called "mechanisms" in Ubuntu, because I have 20 .mod files. Then I use the command
to compile the .mod files. It works fine in Ubuntu.
Yes, and you get this directory structure:
Code: Select all
So how do you tell your hoc files where to look for the compiled mechanisms?
in hocdir isn't going to do the job.
when I copy those files to Windows, I dont know how to compile the .mod in subfolder. When I use nrnmkdll, it just compile those .mod files into the subfolder, I cannot link to those mechanisms in main folder.
From which I infer that you create a symbolic link inside hocdir that points to the i686 directory. You're right, that isn't very portable--can't do it in MSWin.
You could simply move the nrnmech.dll file from moddir to hocdir, but you'll have to do that every time you recompile the mod files.
You could leave nrnmech.dll in moddir, and insert a hoc statement in your main program that changes the working directory to moddir (this should make NEURON load nrnmech.dll from the new working directory), then change back to hocdir.
You could launch all programs from a DOS box whose working directory is hocdir (for several years MS has been calling it a Command Line Interface Window or some other obscure jargon, but DOS box is easier to write) but include an option on the command line that forces loading of the nrnmech.dll from the moddir--the complete command would look something like this
full_mswin_path_to_neuron.exe -dll full_mswin_path_to_nrnmech.dll your_main_hoc_file.hoc
c:\nrnxx\bin\neuron.exe -dll c:\nrnxx\demo\release\nrnmech.dll
This could be made less painful by creating an MSWin "shell script" (".bat file" they used to be called, but now of course there's a new term) that contains the complete command.
The only approach that is truly portable across platforms, without requiring any effort, is to leave the mod files in the same directory as the hoc files, and compile them there.