Interface implementation with a program in С/С++
Let's consider how a C program should be prepared in order to make the WSTP protocol interaction available.
Firstly, as mentioned in the previous chapter, you need to prepare a special tm file that will describe all the data that will interact with Mathematica.
Secondly, the source code written in C should include the standard WSTP header file:
#include "wstp.h"
Note
This file is located in the C:\Program
Files\Wolfram
Research\Mathematica\10.1\SystemFiles\Links\WSTP\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\include
folder.
This file defines the following types:
WSLINK |
A WSTP link object (analogous to LinkObject in the Wolfram Language) |
WSMARK |
A mark in a WSTP stream |
WSENV |
The WSTP library environment |
All functions that return the int
type—return
0
if their execution is not successful.
Thirdly, the external program should be ready to receive instructions from the Mathematica environment; that&apos...