Wolfram LibraryLink provides a powerful way to connect external code to Mathematica, enabling high-speed and memory-efficient execution.

learn more… | top users | synonyms

1
vote
1answer
47 views
3
votes
1answer
84 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 ...
9
votes
1answer
144 views
+50

How to use C language functions in Mathematica?

I'm trying to find out the way to use c-functions in Mathematica (I'm using 14 version) on OS X 10.10. For example I've got this lines of code: ...
0
votes
0answers
16 views

what's the difference between CreateKernelLink() and CreateKernelLink(String Arg)?

I have a .NET program which will connect to MathKernel. When the program runs, there will be a icon of MathKernel on the taskbar. ...
1
vote
0answers
13 views

LibraryFunctionLoad not recognizing datatype

I am trying to use LibraryFunctionLoad with a function that relies on a derived type that is defined within the library. I've loaded the library prior to calling ...
3
votes
1answer
44 views

LibraryLink path problem

I have a library function that need to load some external data files. But it looks that the path in the default path of library function is the path that Mathematica is currently in. Is there a way ...
5
votes
1answer
154 views

How to use MKL from Mathematica?

MKL has a lot of functions. The question is: how to use these functions directly from Mathematica? Furthermore, Mathematica shipped with some MKL libraries, which is located in ...
2
votes
0answers
36 views

Is it possible to pass a “shared” integer in librarylink?

MTensor supports shared pass, where the argument can be modified in the library function and that modification can be seen in Mathematica side. Is it possible to do the same thing to a integer or ...
5
votes
1answer
61 views

How to return a string from LibraryLink?

I need to return a string from a LibraryLink function. The documentation states: When a string is returned as a result, the Wolfram Language accesses the memory to convert it to its own internal ...
4
votes
0answers
44 views

LibraryLink: is WolframLibraryData libData persistent?

I am writing some C++ code that I want to call both through LibraryLink and independently from Mathematica. Thus it must be compatible with LibraryLink but not depend on it. When calling it from ...
5
votes
1answer
108 views

Undocumented WolframLibraryData::evaluateExpression

It seem there's this promising function in the callback object provided to MathLink C functions: ...
4
votes
0answers
54 views

Machine precision infinity

Is it possible to obtain the machine precision (double) version of Infinity? This is useful when using LibraryLink and C ...
3
votes
0answers
80 views

Compiling/calling Mathematica-generated .so from C

I'm trying to call a compiled function from a C program. I am generating the static object ...
3
votes
0answers
70 views

LibraryLink parallel performance

I'm trying to use a LibraryLink function in parallel. It is an embarrassingly parallel problem, so that no dependency between those parallel tasks. However I can only get the parallel efficiency about ...
2
votes
0answers
40 views

How does parallelization of LibraryLink function call work?

I'm trying to call a C function in parallel through LibraryLink. Here is an example kind of demonstrates that library function can be used in parallel. My question is what happened in the library ...
8
votes
1answer
134 views

How to understand shared passing of a MTensor in LibraryLink?

According to the documentation, there are four different type of memory managing when passing a MTensor with LibraryLink: Automatic, "Constant", "Manual" and "Shared". The Automatic and "Manual" is ...
12
votes
1answer
167 views

What are the differences between library call back functions and WolframCompileLibrary macros?

I'm trying to use LibraryLink in Mathematica, and come across some problems. Consider if we have a MTensor m1 which contains a one dimensional double array, and I ...
4
votes
1answer
157 views

Passing Mathematica function via MathLink or LibraryLink to c (or c++)

I want to numerically solve the heat equation. To do so I wrote a program in C++ - It is a BVP $(\alpha T +\kappa \frac{\partial T}{\partial r}=f(t))$, where $f(t)$ is an arbitrary function, whose ...
5
votes
1answer
89 views

LibraryUnload fails

I can load my library, but I cannot unload it with LibraryUnload. I do have a ...
5
votes
1answer
232 views

How to load FORTRAN libraries through Librarylink

First, the main reference is the thread Linking FORTRAN with Librarylink, which teaches how to make the link between a FORTRAN subroutine and a Mathematica code, by using Librarylink. This must done ...
10
votes
2answers
338 views

How can I use shared libraries in LibraryLink code and ensure Mathematica will find them?

I need to use shared libraries in some LibraryLink code. The shared library is installed in a custom location because it was also compiled by myself. When I try to load functions from the ...
10
votes
0answers
543 views

Using TetGen in Mathematica to get 3D Voronoi diagram

In this post, the use of TetGen for 3D Voronoi tesselation has been briefly discussed. However there is still no info about the use of TetGen to generate a 3D Voronoi diagram. The TetGen documentation ...
6
votes
1answer
122 views

How to use MacPorts' gcc with CreateLibrary?

Short version: What's the simplest way to use MacPorts' gcc with CreateLibrary? Long version: CreateLibrary uses ...
10
votes
3answers
232 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 ...
9
votes
0answers
146 views

What was added to the LibraryLink API in version 9?

Looking at the LibraryLink examples, there are several new functions and objects, as well as example programs, that appeared in version 9. Are these documented? If yes, where? If would be nice to ...
3
votes
1answer
140 views

LibraryLink Documentation

The documentation for LibraryLink has the following example ...
4
votes
0answers
91 views

2X slower with ; — LibraryLink performance problem [duplicate]

This is the continued problem of the LibraryLink memory usage question here and here. In the following code, there is a 2X performance difference with only the change of ";". ...
8
votes
1answer
176 views

Where is my memory? — LibraryLink never returns the memory

This is an example LibaryLink code from Mathematica documentation, which takes an integer and return an integer list: ...
7
votes
2answers
295 views

Why LibraryLink function crashes at a second time?

I'm trying link one of Lapack's function to Mathematica through LibraryLink, and the Library function works great at the first execution but crashes at the second time. Here is the code (modified ...
14
votes
1answer
249 views

Dynamic and LibraryLink: dynamic visualization of a simulation

I am asking this question to save some time and I am expecting answers only from people who have tried something like this before. (I realize that I could just try it and see if it works, but that ...
5
votes
2answers
412 views

How to convert data types in a LibraryLink wrapper

I have a dynamic library which I want to load into Mathematica using LibraryLink. I don't have access to the source code of the library, so I need a C wrapper to do the job. In the C wrapper, I would ...
22
votes
4answers
2k 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 ...
8
votes
2answers
228 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 ...
3
votes
1answer
145 views

What is causing a type error when trying to modify Mathematica state from a function linked with LibraryLink

I've managed to reduce my problem to a very simple C program: ...
2
votes
0answers
108 views

Why am I getting an error from MLPutFunction after getting the MathLink from LibraryLink?

Based on the example on the documentation page for processMathLink, I've got the following C++ code: ...
2
votes
1answer
173 views

Supported options for compiling LibraryLink code with VC++

I have to generate an interface to Mathematica for a fairly large library. I would like to use LibraryLink, as the generation seems much simpler. The platform is Windows (VS 2012), and I am ...
2
votes
2answers
136 views

LibraryFunctionLoad hangs under Windows

I'm running the Wolfram Finance Package version of Mathematica 8, under Windows 7 Professional. Any time I attempt to call LibraryFunctionLoad, the Kernel seems to ...
4
votes
0answers
113 views

How can I link the c library GAUL into Mathematica?

Is there a way to load the library GAUL (Genetic Algorithm Utility Library) for use within Mathematica?
8
votes
1answer
390 views

Converting other C++ classes to MTensor in LibraryLink

Hopefully this will be a quick question + a quick answer: Say I have a C++ (or C) code using LibraryLink. I am using a library that defines a specific matrix class, as many numerical libraries ...
9
votes
1answer
552 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 ...
5
votes
1answer
261 views

Accessing methods and properties of C++ objects?

Is it possible to access the properties or methods of C++ objects created with LibraryLink or MathLink like with J/Link ? Such capability doesn't seem built-in yet and I'm not sure it ever will as ...
13
votes
1answer
291 views

Using Boost with CreateLibrary

I was looking at the answer of Leonid of Faster alternatives for DayOfWeek and wanted to see how hard it would be to do something similar in C++ using an external library like Boost. I tried to ...
7
votes
2answers
719 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 ...
26
votes
1answer
939 views

Linking FORTRAN with Librarylink

FORTRAN code can be called using MathLink or .NET/Link (see the link for a worked examples). But as mentioned in a talk by T.Gayley and J.Klein in Wolfram Technology Conference 2011, LibraryLink, ...
2
votes
1answer
3k views

Visual Studio Express 2010 on x86-64: libcmt.lib missing

The CCompilerDriver documentation explains that to use visual studio express on 64-bit targets, it's necessary to install the windows SDK after installing visual studio. I have done this, first ...
62
votes
5answers
4k 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 ...