I wrote a small dynamic library in C for MacOSX which evaluates Mathematica expression using the C MathLink functions.
It works fine, except for the Export command: I want to export a plot to a file, but no file is created with this code:
MLPutFunction(lp, "EvaluatePacket", 1);
MLPutFunction(lp, "Export", 2);
MLPutFunction(lp, "ToExpression", 1);
while((pkt = MLNextPacket(lp), pkt) && pkt != RETURNPKT)
pkt = MLGetString(lp, &res);
The MLGetString correctly returns the path to the file, but no file is created, and the same code works fine when using the LinkRead/LinkWrite functions in Mathematica itself... Also, similar code without using Export works fine, so I have no idea what could be wrong here?