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
0 votes
0 answers
44 views

Is it possible to run kernel in address space of another process?

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 ...
user avatar
2 votes
0 answers
71 views

LibraryFunctionLoad with swift library

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 ...
user avatar
  • 81
6 votes
2 answers
252 views

Speedup the production of a sparse symmetric matrix with a dense vector

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 ...
user avatar
  • 141
6 votes
1 answer
384 views

Mathematica call C++ Eigen to calculate sparsematrix multiplication

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 ...
user avatar
  • 141
4 votes
0 answers
64 views

Should I worry about concurrent access to LibraryLinked code?

According to these answers, when several heterogeneous results (say {MTensor, mint, double}) are needed to be returned from a LibraryLink ...
user avatar
  • 163
7 votes
2 answers
146 views

Can LibraryLink receive and output a list of strings?

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 ...
user avatar
  • 4,856
1 vote
0 answers
42 views

Substitute for MathLink to integrate PARI with Mathematica?

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....
user avatar
  • 11.3k
3 votes
2 answers
98 views

MTensor of MTensor (aka List of List)

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 ...
user avatar
5 votes
1 answer
125 views

Difference between MTensor and MNumericArray in Mathematica

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 ...
user avatar
  • 2,751
2 votes
0 answers
90 views

LTemplate and external library Armadillo

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....
user avatar
  • 822
6 votes
1 answer
72 views

Default compiler optimization flag used by LibraryLink (CreateLibrary)?

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?
user avatar
  • 489
3 votes
0 answers
172 views

Using MinGW-w64 from MSYS2 with LibraryLink

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 ...
user avatar
  • 224k
3 votes
1 answer
187 views

How to get information from all built-in Mathematica functions in order to create a Kotlin library like the Wolfram Client Library for Python?

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 ...
user avatar
  • 1,426
5 votes
2 answers
166 views

Using WSTP with LibraryLink

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 ...
user avatar
  • 153
2 votes
1 answer
57 views

ParallelTable does not evaluate DLL functions

I have a function programed in C which I load in MMA with ...
user avatar
1 vote
1 answer
101 views

LibraryFunctionLoad with Cool Prop documentation

I use the following command ...
user avatar
  • 11
0 votes
0 answers
34 views

Improving performance of LibraryLink evaluation

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 ...
user avatar
  • 1
2 votes
2 answers
478 views

Couldn't load OpenSSL library in 12.1 (Windows)

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 ...
user avatar
0 votes
0 answers
91 views

NestList with LibraryFunction

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. ...
user avatar
  • 1,556
5 votes
1 answer
95 views

MathLink: How do I send a bigint?

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 <...
user avatar
  • 224k
3 votes
1 answer
291 views

Meson build system + C/C++ LibraryLink, help needed for portability check/fix (Windows &MacOs)

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 ...
user avatar
1 vote
0 answers
64 views

Loading machine learning library without enabling my discrete Nvidia GPU? [closed]

I've asked a similar question [here]. I cannot use some of the machine learning modules without enabling my discrete Nvidia GPU. My setup: Ubuntu 16.04 on a Dell XPS-15 9560 Intel i7 CPU with 8-...
user avatar
1 vote
0 answers
129 views

How to check the visibility of and load a dependency Dynamic Link Library (DLL) to the Kernel?

I compiled (on Windows 10, using MinGW) a Dynamic Link Library that implements an interface to another one. I then use LibraryLoad[dependencyDLL] and then ...
user avatar
1 vote
1 answer
79 views

Problem with calling dll file using LibraryLink with ParallelMap and Map for large data

I am trying to call a .dll file via LibraryFunctionLoad where the .dll file is placed in "C:\ProgramData\Mathematica\SystemFiles\LibraryResources\Windows-\ x86-64\CoolProp.dll". When I call this ...
user avatar
  • 171
2 votes
2 answers
210 views

LibraryLink C++ void function, mathematica wrapper

I am trying to include a C++ function into the Mathematica wrapper. There is a void function to change the reference state. The original wrapper includes the following C++ function. Here is ...
user avatar
  • 171
2 votes
0 answers
101 views

LTemplate C++ code seems to run faster than the same code compiled outside of Mathematica

I am slightly puzzled by now and am not able to figure out what's going on inside of LibraryLink (used by LTemplate) to justify what I recognized: I have C++ code that is way too extensive to be ...
user avatar
  • 822
2 votes
1 answer
143 views

Compile errors after reloading of laptop contents after challenging MacOS Mojave installation

I tried (foolhardily, it appears) installing macOS Mojave Version10.4 on my MacBookAir, but encountered major problems--that seemed to have been (finally) fixed after a reinstallation and reloading of ...
user avatar
3 votes
1 answer
60 views

Get Library Name from WolframLibraryData

When developing with LibraryLink, is there any way to get the function name from inside the library ? I don't think there is a way to find out the name of the function that have been used to access ...
user avatar
  • 921
12 votes
0 answers
143 views

LibraryLink: How to read from a Mathematica stream in C?

Mathematica has a flexible streams interface. Functions like Read can read from a "stream" that may be backed by a file, pipe, string, network resource, etc. We can ...
user avatar
  • 224k
5 votes
2 answers
88 views

Bounds for LibraryFunction arguments of integer type

I am trying to load a function written in C++ using LibaryFunctionLoad. Doing so, I have encountered an issue I believe to be a bug (I wanted to ask here first in ...
user avatar
  • 23.2k
4 votes
1 answer
76 views

Extract RawArray from Audio

Audio objects backed by in-memory data (not files) seem to contain a RawArray. Is there a way to get the ...
user avatar
  • 224k
0 votes
0 answers
107 views

Use MMA generated function in C

I am trying to use MMA generated function and call it form C. The function is (MMA env): ...
user avatar
  • 488
7 votes
0 answers
123 views

LibraryLink: Create SparseArray directly from row pointers and column indices

In Mathematica, sparse arrays use a CSR representation. Suppose I already have data in this format. Is there a way to create an MSparseArray from it directly with ...
user avatar
  • 224k
2 votes
0 answers
45 views

Is it safe to change MSparseArrays which lack column indices?

I am using sparse arrays with LibraryLink. I noticed that when MSparseArray_fromExplicitPositions and MSparseArray_fromMTensor ...
user avatar
  • 224k
5 votes
0 answers
102 views

Trying to create rank-1 SparseArray through LibraryLink causes crash

Bug introduced in 10.0 or earlier and fixed in 11.3 When I try to create a 2D SparseArray through LibraryLink's MSparseArray_fromExplicitPositions, it works fine. ...
user avatar
  • 224k
4 votes
1 answer
57 views

How can I test for the size of the mint type at compile time?

It is useful to know the size of LibraryLink's mint type at compile time, for interoperability with other libraries. For example, should I use the ...
user avatar
  • 224k
3 votes
1 answer
123 views

Cross-version compatibility of LibraryLink libraries

I am looking for practical advice on the cross-version compatibility of LibraryLink libraries. In particular, I would like to understand the significance of the ...
user avatar
  • 224k
10 votes
0 answers
118 views

Compile M11.1-compatible LibraryLink libraries using M11.2

WolframLibraryVersion, defined in WolframLibrary.h, was bumped from 3 to 4 in Mathematica 11.2. This causes libraries compiled ...
user avatar
  • 224k
1 vote
0 answers
172 views

How to find out all function and its parameter in a .dll file

Cross post here Since LibraryFunctionLoad can load a function from .dll file like ...
user avatar
  • 23.1k
4 votes
1 answer
240 views

How to use OpenCVLink

Since OpenCV provide C++ API,and the Mathemtica provide so many method to connect C++. I think we can call it with our Mathematica. The OpenCV provide many powerfull function for image-processing. It ...
user avatar
  • 23.1k
3 votes
1 answer
79 views

What does the "AutomaticDelete" option for LibraryFunctionLoad do?

Apparently, LibraryFunctionLoad has an option "AutomaticDelete" with default setting ...
user avatar
1 vote
1 answer
116 views

LibraryLink`$LibraryError is "dlsym(..., WolframCompileLibrary_wrapper): symbol not found" after successful LibraryFunctionLoad

On my computers (Mac OS X 10.10 and 10.11) Mathematica 10.3, running the first example in the documentation for LibraryFunctionLoad returns a working ...
user avatar
6 votes
1 answer
151 views

MTensor from existing memory?

I am wondering whether it's possible to return a tensor from my C++ code using LibraryLink without copying the memory (because it's large). So, instead of ...
user avatar
  • 767
3 votes
2 answers
989 views

Initialize multiple instances of the same library with global variables

I need to initialize multiple instances of the same library that has global variables. The naive way of LibraryFunctionLoading functions multiple times doesn't ...
user avatar
5 votes
2 answers
121 views

How to carry out arithmetic operations on mcomplex in LibraryFunction

I want to perform some arithmetic inside the C++ code using mcomplex data type defined in WolframLibrary.h, but the compiler ...
user avatar
5 votes
1 answer
224 views

How to create dll so they can be LibraryFunctionLoad'ed by earlier versions of Mathematica

I found that LibraryFunctionLoad fails to load functions from dylibss created by later versions of Mathematica. When creating ...
user avatar
2 votes
1 answer
82 views

How do I return an mcomplex NAN from C++ to Mathematica using LibraryLink?

I need to deliberately return a 'NAN' from a LibraryLink function, which is expected to return mcomplex so it appears as ...
user avatar
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
2 votes
0 answers
196 views

Trouble loading MXNetLink in console mode [closed]

I'm using v11.1 on ubuntu, any ideas what is wrong here: In[3]:= << MXNetLink` ...
user avatar
  • 3,720
7 votes
1 answer
213 views

Can you trigger update of Dynamic elements from a LinkedLibrary?

Is it possible to write a LinkedLibrary (or WSTP executable) computing a function f such that Dynamic@f[] is updated when the ...
user avatar
  • 5,559