I am trying to run a Mathematica example concerning Mathematica interfacing issues with C programs. In particular I am trying to call a Mathematica function from C.
Example factor.c
is the best in my case. As explained here at the Invoking the Mathematica Kernel from Within a Prebuilt Example section, I successfully build the examples (using the makefile through make all
). After that I run the exaple as explained by typing:
./factor -linkmode launch -linkname 'math -mathlink'
But I get back to my shell after launching the program with no output as I did nothing. Then I try again just by launching ./factor
, the program then asks me: Create link:
, so I type 'math -mathlink'
, prfess ok, then it prompts: Integer to factor:
, I type a 6 digit one and after that the program blocks (it waits for something, but after 5 minutes I kill it).
Consider that I am on Unix. My Mathematica installation is in this path /home/myuser/progs/Mathematica...
. I run the example respectively with Mathematica running and not running. Same results.
How to make the example work?
Something strange
When I kill theprograms that I launch but stay on wait as I described before, it seems that they finally got killed, but it is not! When I try ps
on my shell, they are there!!! Need to send SIGKILL
to definetely get rid of them...
About links...
I bumped into a Mathematica function called LinkCreate. Maybe I need to run Mathematica, open a link from the interface, and then launch the example? I am trying some, so far no results, will keep on doing so...