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

learn more… | top users | synonyms

51
votes
5answers
3k 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 ...
24
votes
1answer
726 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, ...
18
votes
3answers
1k 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 ...
10
votes
2answers
181 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 ...
4
votes
2answers
331 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 ...
8
votes
1answer
166 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: ...
14
votes
1answer
206 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 ...
13
votes
1answer
272 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
207 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 ...
10
votes
3answers
173 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 ...
8
votes
1answer
355 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 ...
6
votes
1answer
76 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 ...
5
votes
2answers
250 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 ...