Questions tagged [mathlink-or-wstp]

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

Filter by
Sorted by
Tagged with
121 votes
7 answers
13k views

Minimal effort method for integrating C++ functions into Mathematica

Update: While at the time of writing the question loading DLLs with .NET/Link seemed easier, now I always use LibraryLink, which I recommend to anyone with a similar problem! As of Mathematica 8, ...
user avatar
  • 227k
70 votes
6 answers
30k 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 ...
user avatar
  • 1,436
47 votes
1 answer
2k views

Transferring a large amount of data in parallel calculations

Bug fixed in version 11.1 Functions like MemberQ, FreeQ, etc. no longer unpack. Yay! This question is inspired by one of @...
user avatar
  • 227k
33 votes
3 answers
2k 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 ...
user avatar
  • 1,597
31 votes
2 answers
2k 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 ...
user avatar
  • 265k
29 votes
1 answer
1k views

Asynchronous Programming

Consider that you would like to listen for Raw WiFi Packets coming into your NIC. Since Mathematica doesn't have built-in functions for such low level programming (as far as I know), one alternative ...
user avatar
28 votes
4 answers
8k 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 ...
user avatar
  • 9,482
27 votes
3 answers
655 views

Can Mathematica edit large binary files in-place?

I have a very large binary data file (several hundred GB) which I would like to edit using Mathematica. The only edits required are a few isolated byte replacements—no insertions or deletions. Is it ...
user avatar
  • 2,297
25 votes
6 answers
1k 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 ...
user avatar
  • 227k
23 votes
2 answers
878 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 ...
user avatar
22 votes
2 answers
612 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 ...
user avatar
  • 1,412
19 votes
1 answer
1k views

What is the difference between MathLink and WSTP? Which one should I use?

What is the difference between MathLink and WSTP programs? Will the use of MathLink protocol be maintained or not?
user avatar
  • 191
19 votes
1 answer
424 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 ...
user avatar
  • 111k
19 votes
0 answers
1k 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 ...
user avatar
  • 191
18 votes
3 answers
5k 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 ...
user avatar
  • 421
18 votes
1 answer
1k 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 ...
user avatar
  • 183
18 votes
1 answer
562 views

MathLink (WSTP) vs LibraryLink performance

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: ...
user avatar
  • 227k
17 votes
5 answers
2k 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 ...
user avatar
  • 227k
16 votes
1 answer
1k views

C++ interface to large project

We are developing a quite large mathematical software in C++ and would like to have a Mathematica interface. We have our own C++ library and our idea would be, to write a Mathematica wrapper class and ...
user avatar
  • 263
15 votes
4 answers
2k 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 ...
user avatar
  • 4,941
15 votes
1 answer
1k 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?
user avatar
  • 6,363
15 votes
2 answers
344 views

What is the best way to transfer arbitrary-precision reals using WSTP?

I'm developing a Mathematica package, inside of which there is a number-crunching function. It uses a list of arbitrary-precision numbers as input and it takes a lot of time to do its job. So I've ...
user avatar
  • 529
14 votes
3 answers
2k 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?
user avatar
  • 227k
14 votes
2 answers
826 views

Specifying the ports used by LinkCreate or LinkLaunch

Whenever a Link is created using LinkCreate or LinkLaunch with ...
user avatar
  • 33.3k
14 votes
2 answers
540 views

Link server WSTP API feature not receiving incoming connections

I'd like to apologize ahead of time that this may be a very long post but want to get all of this out there. Also, this post really only pertains to those with WSTP/MathLink experience. My problem ...
user avatar
  • 582
14 votes
1 answer
1k 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., ...
user avatar
  • 4,941
14 votes
1 answer
1k 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 ...
user avatar
13 votes
1 answer
599 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 ...
user avatar
  • 3,523
13 votes
2 answers
807 views

Connect Frontend to Kernel Started by JVM via JLink

I have a MathKernel started and controlled via JLink from a JVM. The $CommandLine for this kernel is: ...
user avatar
  • 733
13 votes
1 answer
835 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 Inf...
user avatar
  • 227k
13 votes
1 answer
463 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, ...
user avatar
12 votes
3 answers
262 views

How to return escaped characters from MathLink?

I'd like to return Greek symbols through MathLink from a C function. However, returning the usual escape sequence (such as \[Alpha]) does not seem to work. Here's a minimal example .tm file (myalpha....
user avatar
  • 171
12 votes
1 answer
871 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 ...
user avatar
12 votes
1 answer
749 views

How to set up LinkSnooper for monitoring FrontEnd--Kernel communication?

What is the simplest way to set up LinkSnooper to monitor the communication between the Kernel and the Front End? I am looking for an answer that works on all platforms, including 32-bit Windows.
user avatar
  • 9,909
12 votes
1 answer
1k 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: ...
user avatar
  • 4,777
11 votes
2 answers
715 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?
user avatar
  • 243
11 votes
1 answer
640 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 (I've ...
user avatar
  • 8,628
11 votes
1 answer
933 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. ...
user avatar
  • 213
11 votes
1 answer
2k 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 ...
user avatar
  • 111
11 votes
3 answers
25k 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 /Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/...
user avatar
11 votes
1 answer
204 views

Why does LinkRead block when LinkReadyQ returns True?

The LinkRead documentation states: LinkRead will wait until it has read a complete expression before returning. You can test ...
user avatar
  • 227k
11 votes
1 answer
2k 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 ...
user avatar
  • 1,477
10 votes
2 answers
362 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 ...
user avatar
  • 227k
10 votes
1 answer
2k views

Mathematica NDSolve and 'Compile'?

Since the consensus is usually that NDSolve speeds fares badly against compiled code such as c++ ODE solvers using GSL say, is it possible to make up for this lag ...
user avatar
  • 2,075
10 votes
1 answer
394 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 ...
user avatar
10 votes
0 answers
1k views

ParallelTable kernels die - maybe Mathlink timeout?

I am new to parallel computing in Mathematica. I am using LaunchKernels[16] ParallelTable[] to parallelize calculations. The ParallelTable consists of approx ...
user avatar
9 votes
2 answers
572 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 ...
user avatar
  • 227k
9 votes
2 answers
240 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 ...
user avatar
  • 227k
9 votes
1 answer
376 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?
user avatar
  • 93
9 votes
1 answer
775 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 ...
user avatar
  • 950

1
2 3 4 5 6