Group Abstract Group Abstract

Message Boards Message Boards

How to connect from C++ app to Wolfram Engine using WSTP

Posted 3 years ago

Hello,

I'm trying to hookup an existing C++ application to the Wolfram Engine. I've been reading the C API docs[1], the Windows dev guide[2], and the example C code bundled with the Engine.

I'm stuck trying to launch the Wolfram Engine in the background, when the C++ app starts. The only way I've been able to create a link is using the following code:

WSEnvironmentParameter eParams = WSNewParameters(WSREVISION, WSAPIREVISION);
WSInitialize(eParams);
std::string linkInfo = "-linkname foo -linkprotocol SharedMemory -linkmode launch"; 
link = WSOpenString(ep, linkInfo.c_str(), &err);
if (link == nullptr) {
    return false;
}

However, this causes a Windows Prompt to pop up to select the MathKernel.exe, when the C++ app starts.

I would like the C++ application to run the MathKernel in the background, and to shut it down when the C++ application exits.

How can the C++ application launch the MathKernel app in the background, without having the prompt to select the app?

[1] https://reference.wolfram.com/language/guide/WSTPCLanguageFunctions.html

[2] https://reference.wolfram.com/language/tutorial/WSTPDeveloperGuide-Windows.html

POSTED BY: V F
Posted 2 years ago
POSTED BY: Alec Graves
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard