I'm building an interface for a Fortran library. I would like to use LibraryLink and Mathematica to do the compilation (via CreateLibrary
), Visual Studio is installed.
So far thing work pretty well, I can call functions and return results using the LibraryLink interface (like MArgument_getInteger()
and MArgument_setReal()
).
Now I'm running into problems. One function returns various numbers, a list and a string as result. A heterogenous return type is not included in the normal LL interface, but there seems to be a way using WSTP.
According to the documentation, in LibraryLink there's an argument type "LinkObject"
, which then uses WSTP to exchange data. The example uses WSGetString
, WSPutString
and so on, but neglects to mention in which header they're defined.
Since I'm using CreateLibrary
to compile the C code, I can't simply add wstp.h
(which exists, but is at a rather different place than WolframLibrary.h
), because I'd also need to include some library to be linked.
So how do I properly use WSTP in my case?