35
votes
Accepted
Asynchronous Programming
Let me give you a very basic example, how you can employ an asynchronously running LibraryLink function for this specific task. I will not do any real packet listen, but only explain the general setup....
26
votes
What is the difference between MathLink and WSTP? Which one should I use?
There is no difference. "WSTP" is just a new name for MathLink.
As part of the renaming they also changed the function names from ML-prefixed ones to ...
25
votes
Accepted
How to use RunProcess to import external function?
Taking user5601's suggestion to do a little demo, I quickly whipped this up as an example of ProcessLink being used to do non-trivial communication between Mathematica and an external program, but ...
22
votes
Multiplayer game in Mathematica: how to communicate between kernels?
Thanks to the new Channel functionality in Mathematica 11, it is now easy to make (basic) multiplayer games with Mathematica!
To demonstrate, I'll modify my hex ...
16
votes
Accepted
WSTP broken by upgrade to 10.0.1?
Under Linux the WSTP shared libraries that ship with Mathematica 10.0.1 for both 64 and 32 bit (libWSTP64i4.so and libWSTP32i4.so...
16
votes
What is the complete list of valid FrontEnd Packet types?
I thought I'd keep a running tally of what I know about these packets (excluding the obvious ones like CreatePalettePacket) just for reference.
Text / Box ...
16
votes
Minimal effort method for integrating C++ functions into Mathematica
In terms of loading C++ functions, I would strongly suggest LibraryLink. It is a great tool except that it requires you to write sometimes intimidating C code.
To make LibraryLink easier to use, I ...
16
votes
MathLink (WSTP) vs LibraryLink performance
At the end of this post you'll find the code for a small benchmark to compare LibraryLink with standard passing vs LibraryLink with MathLink based passing on two counts:
function call overhead; use a ...
16
votes
Can Mathematica edit large binary files in-place?
We can do it straightforward in Java using JLink:
...
14
votes
Minimal effort method for integrating C++ functions into Mathematica
There is a package called LTemplate that automates writing some of the boilerplate code for LibraryLink:
How to simplify writing LibraryLink code?
I consider this less effort than writing standard ...
14
votes
Accepted
C++ interface to large project
This cannot be answered very well without knowing your C++ library much better.
As you said, you have a choice between MathLink and LibraryLink. Generally, I recommend LibraryLink because:
It runs ...
12
votes
Accepted
Tools for MathLink traffic analysis?
The online documentation may indicate that the online documentation is obsolete; the LinkSnooper itself is still alive and kicking! Just go to the Documentation Center and look at the guide page of ...
12
votes
Accepted
Why does LinkRead block when LinkReadyQ returns True?
Sorry, it turns out there's a fairly critical omission in the documentation. LinkReadyQ, and its C cousins WSReady and ...
11
votes
How to return escaped characters from MathLink?
halirutan's answer is correct, but more could be said on the matter, so I'll expand.
First, MathLink/WSTP has no knowledge about the long-name form of various characters. The only Wolfram Language ...
11
votes
Connect Frontend to Kernel Started by JVM via JLink
I was able to get a satisfactory answer to my question by using a very good article by David Wagner, "MathLink Mode" available here.
I'll leave all the JVM stuff out of the answer but the approach ...
11
votes
Callable interface
You should not test pairs of graphs for isomorphism, as that is quadratic in the number of graphs, and it's hopeless. You should compute a canonical labelling of each graph with a suitable library (...
10
votes
Accepted
What is the correct path to add a camera driver?
After 2 years of research and posting this question in other sites, the answer is that although Mathematica (Windows) detects the Camera device, only imaging devices using the Windows video image ...
10
votes
Can you trigger update of Dynamic elements from a LinkedLibrary?
Preface
I will give a complete solution that shows how a dynamic file watcher can be implemented in Mathematica. The file watcher will track the size of the file and when it changes automatically ...
9
votes
How to use Mathematica functions in Python programs?
Better late than never, but the error in the python script appears to be due to the format of the current packet. Using your routine (with k = kernel):
...
9
votes
Write C/C++ programs calling Mathematica functions
The other answers ignore that you are asking about C or C++ (not C# or Java!)
Mathematica can be called from C (or C++) through the MathLink interface (recently renamed to WSTP). To learn it, I ...
9
votes
Accepted
How to set up LinkSnooper for monitoring FrontEnd--Kernel communication?
Use the following command to create a new kernel setup with the name "LinkSnooper":
...
9
votes
Accepted
WSTP simplifying expression from C
You are not evaluating
FullSimplify[(a + a + a + a - b)]
You are evaluating
FullSimplify["(a + a + a + a - b)"]
You used ...
8
votes
Efficiently determining if 3D points are within a surface composed of polygons
In Version 10 we have BoundaryDiscretizeGraphics and RegionMember to the rescue. So here we go:
Reproducing the graphics:
<...
8
votes
Accepted
Fast way to pass an array of integers to Java using JLink
The solution
After a standard initialization step
Needs["JLink`"]
InstallJava[]
What you have to do is actually very simple:
...
8
votes
Link server WSTP API feature not receiving incoming connections
You are missing just one bit of secret sauce to get this to work. When you connect to a LinkServer link directly using WSTP/MathLink functionality, you need to use "-linkoptions 4" in the arguments to ...
7
votes
Write C/C++ programs calling Mathematica functions
C Style
To Call Mathematica functions from C/C++ you need to use ML_ or WS_ functions. ...
7
votes
How to use Mathematica functions in Python programs?
As yet another solution, you can use a new package called PJLink which implements JLink for python.
Once you have the package installed you start a KernelLink ...
7
votes
How to use Mathematica functions in Python programs?
Try Jupyter and SAGE notebook extensions for Mathematica:
http://www.sagemath.org/doc/reference/interfaces/sage/interfaces/mathematica.html
https://github.com/bjedwards/IPython-mathematicamagic-...
7
votes
Why does this LibraryLink example of LinkObject based passing not work? Bug or user error?
This is due to a bug in the example code. Specifically, in reverseString, the type of variable len should be ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mathlink-or-wstp × 251interoperability × 27
c++ × 22
librarylink × 21
java × 16
.netlink × 16
programming × 15
remote-access × 13
parallelization × 11
kernel × 11
front-end × 9
external-calls × 9
windows × 8
functions × 6
python × 6
performance-tuning × 5
bugs × 5
mac-os-x × 5
linux × 5
notebooks × 4
packages × 4
scripting × 4
kernel-startup × 4
networking × 4
graphics × 3