# Tagged Questions

MathLink is a suite of Mathematica functions that implement a protocol for the communication/interfacing of Mathematica with external programs.

6k views

### Minimal effort method for integrating C++ functions into Mathematica

As of Mathematica 8, what is the minimal effort way to integrate an existing C++ function into Mathematica? I think we have these: MathLink (it was quite long ago I used it last time) communication ...
1k views

### Transferring a large amount of data in parallel calculations

This question is inspired by one of @whuber's answers Consider the following code: ...
10k views

### How to use Mathematica functions in Python programs?

I'd like to know how can I call Mathematica functions from Python. I appreciate a example, for example, using the Mathematica function Prime. I had search about MathLink but how to use it in Python ...
1k views

### Calling IronPython code from Mathematica

I'd like to call some IronPython code from Mathematica using .NET/Link. The problem is that the code lives in .py files, yet from Mathematica I can only load .NET assemblies which are DLLs. So it ...
4k views

### Efficiently determining if 3D points are within a surface composed of polygons

This is the 2nd part of a previous question which I edited to make into 2 separate questions: Extracting polygons from 3D contour plot surface As an extension of my earlier question involving simple ...
423 views

### Returning multiple results from a LibraryLink function

What is the best way to return multiple inhomogeneous results from a LibraryLink function? Imagine that the result of a single computation is several tensors of different dimensions and several ...
744 views

### Calling Mathematica from Visual Studio - example

I am trying to set up a connection between Visual Studio 10 and Mathematica 8.0 on a Windows system. I found several sources of information on the Wolfram website, but I get entirely lost. Most of the ...
395 views

### MathKernel doesn't return all Messages

In Mathematica I run this command: Plot[Sin[x], {x, 1, 15}, GridLines -> error] It generates a Plot with this error message: A GridLines specification ...
1k views

### Connecting to and disconnecting from a continuously running kernel, on demand

I realized that there are lots of advantages to driving C/C++/FORTRAN code directly from Mathematica as LibraryLink functions (instead of running them from the command line or a shell script, as I ...
869 views

### How to protect existing MathLink connection from disconnecting

I am developing an application that consists of a Mathematica package and an external Java program. The purpose of the application is to read streamed data from a port and update a variable in the ...
857 views

### Is it possible to use C# LINQ from Mathematica using .NET/Link?

Using Mathematica's .NET/Link (NETLink) package, is it possible to call out to .NET's LINQ facilities for list manipulation and other operations?
355 views

### What is the complete list of valid FrontEnd Packet types?

In response to my question How can I get the unchanged Box form of an arbitrary expression? John Fultz answered with a method using the hilariously named ...
399 views

### Multiplayer game in Mathematica: how to communicate between kernels?

This may have been asked already, but I am considering making a game in Mathematica that two people can play. However, the issue with my idea is that the other player can't view the cards of the first ...
499 views

120 views

Has anyone benchmarked LibraryLink vs MathLink when passing large arrays? Specifically I would like to know how performance compares when using the following to pass and return a large array: ...
336 views

### using MathLink for communication with external program from my C program without Mathematica

I have a compiled program with MathLink. I want to use it from other C program, without Mathematica being involved at all. If i create my program with MathLink and connect to this external program, ...
936 views

### How to run mathlink external commands in parallel?

I have an external function called increment (for the sake of illustration) that I call from Mathematica using MathLink. I.e., ...
634 views

### How to run an external program in parallel with a Mathematica package?

Under Mathematica 8 (Linux x84_64) I was able to run an external program in parallel from a Mathematica package. However this procedure breaks down under Mathematica 9. Within my Mathematica package ...
77 views

### Control Front End in “mathlink” mode

Note: This question was already posted in the Wolfram community. In a terminal math session, we can start a front end (FE) easily by launching it though ...
507 views

### WSTP broken by upgrade to 10.0.1?

Bug introduced v10.0.1 and fixed in 10.0.2 Everything was working fine with WSTP (the successor to MathLink) in 10.0.0. But I upgraded to 10.0.1 today and now I can't compile either my programs ...
2k views

### Write C/C++ programs calling Mathematica functions

I need to write a C/C++ program and call some functions in Mathematica especially those like Solve or NDSolve. The problem is ...
791 views

### Example program for calling Mathematica from C

I want to call Mathematica from a C program. Suppose I have two numbers x = 2 and y = 3. I want to define ...
666 views

### Correct way to handle mysterious NaN result from MathLink function

I have a Mathematica expression that is mapped onto an external C function via MathLink. The external function passes a ...
351 views

I have a MathKernel started and controlled via JLink from a JVM. The $CommandLine for this kernel is: ... 2answers 504 views ### How can I connect Mathematica to Clojure? I'm using Clojure and I'd really love to be able to use some of Mathematica's functions inside it. Can anyone help with mathlinking it? 2answers 270 views ### MathLink C API: sending a List[] of so far unknown length I would like to send a set of Mathematica expressions (i.e. not simple types that are easy to represent and temporarily store in C) in a List using the MathLink C ... 1answer 106 views ### Fast way to pass an array of integers to Java using JLink I am using a package from java to compress a list of integers, this package provide me two methods, one for compress and other one for uncompress. Each of these methods has a version to ... 3answers 293 views ### Using LinkSnooper for monitoring the communication with an installable MathLink program How can I monitor the communication between an installable MathLink program and the kernel? Can LinkSnooper do this? 2answers 393 views ### Is it possible to set a timeout for LinkWrite[]? This came up in relation to this answer Is it possible to set a timeout for LinkWrite? LinkWrite seems to block until the sent ... 2answers 113 views ### Why does this LibraryLink example of LinkObject based passing not work? Bug or user error? There's an example of LinkObject-based passing in the LibraryLink documentation. Unfortunately the cell in the documentation notebook is corrupted, but to skip ... 1answer 468 views ### Running .NET/Link on Mono (On MacOS or any UNIX or Linux Distro) Has anyone have any luck running .NET/Link on Mono? When I run .NET/Link to call Mathematica from within a Mono program, this is the error message I receive. ... 1answer 628 views ### Mathematica + Numerical Recipes the idea of combining Mathematica with the new routines in the 3rd edition of Numerical Recipes (NR) is very interesting. In fact, there is a NR library to Matlab which works very well because not ... 3answers 17k views ### MathLink linking error after OS X 10.9 (Mavericks) upgrade After macosx 10.9 mavericks upgrade i have a compilation problem, you can see below. Even the examples given in ... 1answer 133 views ### Installing LinkSnooper on Windows I tried to install LinkSnooper on my Windows 7 computer, as described in the documentation and here. According to the answer of @Todd Gayley, I entered the following string in the field MLOpen: ... 1answer 306 views ### Suppress Mathematica Kernel taskbar tab when using .NETLink Is there a possibility to suppress the Mathematica Kernel taskbar tab when accessing it through .NETLink on Windows? 1answer 397 views ### Passing back “NaN” and “Inf” to C via MathLink In the "usual" double representation of floating point numbers in C there is a NaN and an ... 1answer 600 views ### Can you call a C function that takes function pointers as arguments? I want to use MathLink to call a function I wrote in C. However, similar to an integrator, it takes a function pointer as an argument and applies it on numbers depending on the other arguments. I ... 2answers 437 views ### MathLink and C++ vector container The Problem. I have a C++ class that does some computations, and returns a C++ vector object (the length of which can possibly vary with each run). I want to store each of these vectors as a list in ... 2answers 932 views ### Mathematica Library Link : How to use non standard 'mint' e.g. 'unsigned int' or 'long long int' I use Mathematica 8.0.4 on Mac OSX 64 bit, and gcc as C compiler. I am trying to write a LibraryLink function that deals with large positive integers i.e. greater than$2^{31}-1$. By dealing with, I ... 1answer 219 views ### How to use RunProcess to import external function? I have a functions written in an external language called GO. How can I quickly load them into the kernel for use as Mathematica functions? The two ways I've tried are with MathLink and LibraryLink ... 1answer 824 views ### Compiling 64bit MathLink code under cygwin on Windows 7 I am aware that building MathLink executables is not without its challenges. However, I am trying to compile the MathLink example 'addtwo' from a makefile within cygwin on a 64 bit Windows 7 machine. ... 1answer 1k views ### Using Mathlink with the cernlib FORTRAN package MINUIT I could successfully use Mathlink to call a simple fortran subroutine. However, when I went to a realistic problem, I failed. To be specific, I want to fit a set of data with some function using the ... 1answer 279 views ### Type conversion: LibraryLink mint vs. MathLink integer type Assume the following situation: I have a WolframLibrary function which gets as parameter an integer tensor (which is for simplicity of rank 1) and the function should return an integer list through ... 1answer 447 views ### Using NETLink.MathKernel.Compute() for graphics results fails with GraphPlot[] I'm using MMA 8.0 to provide backend on a .NET application I'm writing. I am trying to use the high-level Wolfram.NETLink.MathKernel interface to export an image ... 0answers 236 views ### MathLink error while calling a custom Mathematica function - MLGet out of sequence I am trying to call Mathematica 10 from F#. Following the C# sample code found in the Mathematica directory, I have written the following F# code: ... 0answers 200 views ### Socket communication and player pro I'd like to create a simple communication channel between MMA and the animation package 'Maya'. This is possible over sockets ( very simple, just sending and receiving strings). I've got this working ... 1answer 101 views ###$CurrentLink passing down in MathLink SetDelayed functions

I would like to utilize the MathLink option of having each Install of my package result in a linking object which I can use to control when and how certain elements ...
296 views

### Is the communication protocol underlying MathLink user-customizable?

MathLink supports two communication protocols on all platforms: TCPIP or shared memory. There are additional protocols supported on some systems only ("FileMap" and "Pipes" according to the docs). I ...