Using WSTP with LibraryLink

You will find a complete example at:

$InstallationDirectory/SystemFiles/Links/LibraryLink/LibraryResources/Source/demo_LinkObject.c

It's good to be aware that renaming MathLink to WSTP was a capricious marketing move that brought zero technical benefits but caused quite a bit of harm to compatibility. Now the same system comes under two names, and as two incompatible libraries that use different naming conventions. However, there is no difference in capabilities.

Unless you are using the very latest version of Mathematica (or if you want your code to be compatible with slightly older versions too) use the ML-prefixed functions and mathlink.h, not the WS-prefixed one and wstp.h. Until recently, only the ML-prefixed ones worked with LibraryLink without extra tweaks, even though the renaming to WSTP was done as early as v10.0.