2
$\begingroup$

I am new in mathematica programming. Actually referring this link, I tried to connect to kernel from c++ program on Windows with visual studio. I copied all these .exe files in related folder which i used in my code as well. But it does not connect after lots of separate try. this is my code,

WSENV env;
WSLINK link;
int error;

env = WSInitialize((WSEnvironmentParameter)0);

link = WSOpenString(env, "E:\\ProgrammingProjects\\PhD\\MathematicaTest\\mathfiles\\MathKernel.exe -mathlink",&error);
int res = WSConnect(link);

in this type the returned res is "0" and no connection.

I Also tried WolframKernel.exe

link = WSOpenString(env, "E:\\ProgrammingProjects\\PhD\\MathematicaTest\\mathfiles\\WolframKernel.exe -wstp",&error);
int res = WSConnect(link);

but this code block at connect function and as it said in documentation it means there is no connection. Should I do something more before running this code? Could you help me through this? Thanks

$\endgroup$

1 Answer 1

1
$\begingroup$

I found the answer by checking .NET examples.

lp = WSOpenString(env, "-linkmode launch -linkname \"E:/Software/mathematica/mathkernel.exe\"", &error);

int res = WSConnect(lp);
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.