Skip to main content

Questions tagged [librarylink]

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

Filter by
Sorted by
Tagged with
2 votes
0 answers
71 views

I have a notebook with a workflow that I use to update several servers. I have used it many times and I know it works. Until today. For some reason the ...
Gustavo Delfino's user avatar
1 vote
0 answers
94 views

I encountered an issue with the GeoElevationData function (version 14.2.1, Windows 10 Pro version 2009). In a fresh instance of Mathematica, the example ...
hlediks's user avatar
  • 499
8 votes
1 answer
569 views

Suppose we have two implementations of the same algorithm: A standalone C++ program, compiled into an executable. A C++ library, which is loaded and invoked from within Mathematica. In practice, ...
John Taylor's user avatar
  • 6,063
0 votes
1 answer
208 views

I have been using Mathematica For Desktop v14.2 since its release on several machines running Windows 10 and several running Windows 11. Everything works absolutely fine except for one PC running ...
hlediks's user avatar
  • 499
3 votes
1 answer
201 views

Consider the following code: ...
John Taylor's user avatar
  • 6,063
2 votes
0 answers
80 views

I am trying to build a custom layer for my neural network that can perform its computation on the GPU. The function is to be written in C and loaded in Mathematica via the LibraryLink. Is it possible ...
Sâu's user avatar
  • 575
2 votes
0 answers
137 views

I am trying to use a custom trilinear interpolation written in C in Mathematica (Windows). This is the code I start with: ...
John Taylor's user avatar
  • 6,063
14 votes
3 answers
518 views

I have an external c-function I need to call, and I wish to use ForeignFunctionLoad. The c-function, foo, takes as an argument a reference to a struct, for example: ...
Stefan Gillessen's user avatar
0 votes
0 answers
94 views

I made some code in Mathematica that I compiled in C. It involves operations such as looping inside While, custom random sampling from particular distributions, and ...
John Taylor's user avatar
  • 6,063
5 votes
0 answers
157 views

It's a bit surprising to me that no one asks about this so far, so let me step up :) . In version 13.3, an EXPERIMENTAL Foreign Function Interface has been introduced. I'm by no means a C expert, but ...
xzczd's user avatar
  • 71.6k
2 votes
0 answers
78 views

I am trying to run C++ in Mathematica. I got a package "LTemplate" from the answer from Szabolcs in this post: How to simplify writing LibraryLink code?. However I can't install it. This is ...
xpaul's user avatar
  • 281
3 votes
0 answers
121 views

Hi everyone I work on a Mac M1 Sonoma 14.3 with Mathematica 12.3.1 and 14.0 I have an issue when using a C++ multiroot finding from GSL library. I used this example : https://www.gnu.org/software/gsl/...
Alex's user avatar
  • 51
2 votes
0 answers
163 views

I work on a mac M1 with MacOS Sonoma and i use Mathematica 12.3.1 and 14.0 I wanted to ask if there is a way to load a .dylib library on Mac with Mathematica, which was compiled without using the ...
Alex's user avatar
  • 51
2 votes
0 answers
62 views

I create a C-library and compile it using the tools in LibraryLink. When I create a code binary like this ...
Kirill Belov's user avatar
2 votes
1 answer
137 views

Many internal calls boil down to invocations like LibraryFunction["path/to/library", "funcName" , ...] I'm on a mac, so I can use the ...
Adam's user avatar
  • 4,293
2 votes
0 answers
102 views

Wolfram's website declares that "a large fraction of Mathematica's numerical algorithms are based on original research at Wolfram Research" (cf. So Many Original Wolfram Algorithms). So, ...
user688486's user avatar
1 vote
1 answer
212 views

I cloned LMDB* from https://github.com/LMDB/lmdb and compiled on a Mac M1 with make -e clean liblmdb.so CC="cc -target aarch64-macos-none" which produced ...
Adam's user avatar
  • 4,293
18 votes
1 answer
871 views

I am working on a project that requires repeated calls to HankelH1[0, r] for $r$ spanning the full real axis. When I use the mathematica routine, it can be as much ...
JonBean's user avatar
  • 183
5 votes
1 answer
212 views

I am trying to use third-party libraries in LibraryLink, but the kernel crashes when I call their functions. In particular, I want to make available some functions of SuiteSparse to manipulate ...
Albercoc's user avatar
  • 1,122
2 votes
0 answers
90 views

I believe I have run into a bug with managed library expressions and garbage collection behavior. In the example below, adapted from the documentation for ...
yousufferbutwhy's user avatar
3 votes
1 answer
174 views

I have a compiled function(such as $f\left(z,c\right)=z^2+c$) which will get replaced by different equations as the code runs. I'm using this compiled function(#1) inside another compiled function(#2)....
Laff70's user avatar
  • 171
5 votes
1 answer
253 views

I've the following code ...
csk 7's user avatar
  • 413
0 votes
0 answers
70 views

I would like to change the EoS used by REFPROP to the PR EoS for several calculations. It's stated that the Flags function must be used. " Peng-Robinson or PR 0: Turn off the Peng-Robinson ...
user265228's user avatar
3 votes
1 answer
153 views

Local file demo.c have some library link API example, such as: example 1: ...
yode's user avatar
  • 27.8k
4 votes
2 answers
281 views

librarylink have a dirty signature such as: EXTERN_C DLLEXPORT int fun(WolframLibraryData libData,mint Argc, MArgument* Args, MArgument Res) But when we are in ...
yode's user avatar
  • 27.8k
25 votes
2 answers
771 views

When we arrive at V13.1, we have a great LibraryFunctionDeclaration now, which can call C function in MMA as this article: ...
yode's user avatar
  • 27.8k
1 vote
0 answers
149 views

Here is my goal: I want to call external library functions, written in C (not by me), in Mathematica. I may have found a way to do it using LibraryLink by following this scheme: First, for each ...
User3000's user avatar
  • 311
20 votes
1 answer
1k views

Here is my problem: I'm diagonalizing some matrices using Eigensystem[] to obtain eigenvalues and eigenvectors and I'm diagonalizing the same matrices using a ...
User3000's user avatar
  • 311
30 votes
2 answers
603 views

A LibraryLink library compiled with headers having a certain WolframLibraryVersion will not work with Mathematica versions that support only earlier ...
Szabolcs's user avatar
  • 239k
0 votes
0 answers
79 views

Kernel executables seem to be relatively small wrappers around "dynamic link library" that contains all the functionality of the kernel. Is it possible to load the kernel (as a dynamic link ...
Pavel Perikov's user avatar
2 votes
0 answers
172 views

I'm trying to figure out if there is any sane way to call a swift function using the LibraryLoadFunction. In Swift it seems possible to use @_cdecl to get a c callable dynamic library. When I test ...
Dave's user avatar
  • 81
6 votes
2 answers
580 views

The optimization of the production of a sparse symmetric matrix with a dense vector has existed for a long time. Someone once compared the matrix operations of Mathematica with MATLAB, and then came ...
sidy's user avatar
  • 141
6 votes
1 answer
726 views

I want to use the C++ Eigen library in Mathematica's LibraryLink function. In the past, matheorem called C++ Eigen in Mathematica successfully. However, I am not ...
sidy's user avatar
  • 141
4 votes
0 answers
109 views

According to these answers, when several heterogeneous results (say {MTensor, mint, double}) are needed to be returned from a LibraryLink ...
iago-lito's user avatar
  • 163
8 votes
3 answers
361 views

I need to use libraryLink to process a list of strings, I haven't found a suitable example, confused about the types of the arguments and return types. Does libraryLink directly support it, which one ...
expression's user avatar
  • 5,782
1 vote
0 answers
94 views

How does one access MathLink with current version of Mathematica? I'm trying to integrate the "computer algebra system" PARI with Mathematica, as documented at https://pari.math.u-bordeaux....
murray's user avatar
  • 12.2k
3 votes
2 answers
183 views

In C++ I have a vector of 2D points : typedef std::array<double, 2> Point; std::vector<Point> samples; Now, I'm in LibraryLink and I'd want to pass a ...
Max Tarpini's user avatar
5 votes
1 answer
205 views

Since I'm starting to look into C-programming using LibraryLink to connect Mathematica to computational expensive calculations, I was wondering about the two available options within LibraryLink for ...
Rainer's user avatar
  • 2,961
2 votes
0 answers
169 views

As a great fan of the simplicity of the LTemplate library for the end user I am now faced with a problem when apparently everything compiles correctly but the functions are not loaded from the library....
pbx's user avatar
  • 842
6 votes
1 answer
136 views

What's the default optimization level (e.g. -O2, -O3) used by the function CreateLibrary, which invokes the system compiler to compile C/C++ code for use in LibraryLink?
felix's user avatar
  • 579
3 votes
0 answers
274 views

I am looking to use the MinGW-w64 version of gcc, as bundled with msys2, with LibraryLink. It was communicated to me that in recent versions of Mathematica, one may use the MinGWCompiler compiler ...
Szabolcs's user avatar
  • 239k
3 votes
1 answer
338 views

I'd like to use (if this already exists) or create a library to use Mathematica together with Kotlin (or Java) (not JLink, please see below). We already have this very useful implementation for ...
GarouDan's user avatar
  • 1,536
5 votes
2 answers
357 views

I'm building an interface for a Fortran library. I would like to use LibraryLink and Mathematica to do the compilation (via CreateLibrary), Visual Studio is ...
Batox's user avatar
  • 153
2 votes
1 answer
125 views

I have a function programed in C which I load in MMA with ...
Denis Cousineau's user avatar
1 vote
1 answer
222 views

I use the following command ...
Cezary's user avatar
  • 11
0 votes
0 answers
60 views

I have a large function that I want to integrate with an integration routine. The function is supposed to be built out of LibraryLink functions, but I find evaluating the function to be very slow, and ...
Marco's user avatar
  • 1
2 votes
2 answers
956 views

Update: Finally I found a clumsy way to solve this bug by myself: I created an alternate local kernel to run the code, and it surprisingly works out! It is ridiculous that two local kernels contain ...
Pei-Xin Shen's user avatar
0 votes
0 answers
124 views

Edit Same behavior without FORTRAN and undocumented part. What can be wrong in this case? LibraryFunction below is supposed to be just an identity function. ...
I.M.'s user avatar
  • 3,516
5 votes
1 answer
166 views

Suppose I have a big integer from some library such as GMP. I need to return this from a LibraryLink function. What is the most efficient way to do it? The simplest way is to convert it to a string <...
Szabolcs's user avatar
  • 239k
3 votes
1 answer
381 views

As a proof of concept I have created a github repository that shows how to: use the Meson build system to create a Mathematica package using LibraryLink functions The goal is to provide an easy to ...
Picaud Vincent's user avatar