Compile models from hoc code.. need an updated hack

Particularly useful chunks of hoc and/or NMODL code. May be pedestrian or stunningly brilliant, may make you gasp or bring tears to your eyes, but always makes you think "I wish I had written that; I'm sure going to steal it."
Post Reply
rcalinjageman
Posts: 1
Joined: Thu Sep 27, 2018 10:05 am

Compile models from hoc code.. need an updated hack

Post by rcalinjageman » Fri Sep 28, 2018 1:15 pm

I am looking for an updated way to compile model files from within hoc code.

Why? I distribute a simulation that uses custom model files to students in one of my neuroscience courses. I want them to be able to download and unzip the files, then run a single hoc file without having to learn how to compile models for themselves. Students are working on their home machines, so I can't compile them for them.

Long ago I came across this hack, but it is not working on modern versions of neuron:

Code: Select all

      load_file("stdlib.hoc")
      s = new String()
      sprint(s.s, "sh mkdll.sh %s \"%s\" %d", $s1, $s2, unix_mac_pc())
      system(s.s, s.s)
Defining a string has changed, and it looks like aspects of the system call have changed, as even defining the string properly gives an error in the sprint line.

I wasn't easily able to find another way to do this, so I thought I'd ping the forum. Any help would be greatly appreciated.

Cheers,

Bob

hines
Site Admin
Posts: 1527
Joined: Wed May 18, 2005 3:32 pm

Re: Compile models from hoc code.. need an updated hack

Post by hines » Tue Oct 02, 2018 2:48 pm

you are missing a declaration of s
objref s

Post Reply