Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [librarylink]

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

2
votes
1answer
95 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 ...
1
vote
0answers
44 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-...
1
vote
0answers
43 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 ...
0
votes
1answer
51 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 ...
2
votes
2answers
92 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 ...
2
votes
0answers
73 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 ...
1
vote
1answer
61 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 ...
3
votes
1answer
47 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 ...
0
votes
0answers
23 views

how to add header (.h) file to CUDALink Mathematica?

I am purely new to CUDALink. How can I add new .h files, for example #include math.h. If someone writes the file math.h, and I would like to include it in CUDALink,...
10
votes
0answers
92 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 ...
5
votes
2answers
77 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 ...
4
votes
1answer
62 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 ...
0
votes
0answers
80 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): ...
7
votes
0answers
69 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 ...
1
vote
0answers
25 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 ...
3
votes
0answers
65 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. ...
4
votes
1answer
44 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 ...
3
votes
1answer
96 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 ...
10
votes
0answers
109 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 ...
1
vote
0answers
47 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 ...
2
votes
1answer
150 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 ...
3
votes
1answer
71 views

What does the “AutomaticDelete” option for LibraryFunctionLoad do?

Apparently, LibraryFunctionLoad has an option "AutomaticDelete" with default setting ...
1
vote
1answer
94 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 ...
6
votes
1answer
113 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 ...
3
votes
2answers
137 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 ...
5
votes
2answers
94 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 ...
5
votes
1answer
107 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 ...
2
votes
1answer
65 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 ...
14
votes
1answer
960 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 ...
2
votes
0answers
146 views

Trouble loading MXNetLink in console mode [closed]

I'm using v11.1 on ubuntu, any ideas what is wrong here: In[3]:= << MXNetLink` ...
4
votes
1answer
125 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 ...
4
votes
1answer
123 views

Why does LibraryLink return Indeterminate sometimes?

I have a LibraryLink application and I have debugged it with VS. That is to say, the corresponding C code is totally right. However, when I test it in Mathematica, sometimes it gives the correct ...
10
votes
1answer
261 views

How to enable C++11 in a platform independent manner?

I need to enable C++11 features when using CreateLibrary. I need a solution which will work with (almost) any compiler on any operating system. Generally, this can ...
9
votes
1answer
129 views

How to cross-compile LibraryLink code for multi-platform distribution

I am running Mathematica on a Windows 10 machine and I would like to develop a package for public distribution. Most of the package will be Mathematica code, but some timing-critical parts should be ...
32
votes
1answer
928 views

How can I work with RawArray?

RawArray seems to be able to efficiently hold integer and floating point data of various sizes. What is RawArray good for? How ...
6
votes
0answers
94 views

LibraryLink: What are DataStore and WolframIOLibrary?

Version 9 introduced DataStore and WolframIOLibrary_Functions in WolframLibrary.h. They don'...
6
votes
0answers
47 views

A Swig-like template generator for LibraryLink

I am slowly, manually, constructing an interface to an external-API library (built in .cpp) using LibraryLink. The semi-...
30
votes
2answers
558 views

Why is CompilationTarget -> C slower than directly writing with C?

Probably a hard question, but I think it's better to cry out loud. I've hesitated for a while about whether I should post this in StackOverflow with a c tag or not,...
0
votes
0answers
246 views

Using shared library in LibraryLink

Recently I've asked a question somewhat related to this[*], but I consider this an actual new problem. So I hope it is indeed appropriate to ask you again. I have created a shared C++ library (with ...
8
votes
1answer
181 views

How to maintain a large LibraryLink project?

I have a LibraryLink project, which became more and more larger(about 50 LibraryLink wrapper functions, 8000 lines ANCI C code). Curently, I just use a simple *.c ...
1
vote
1answer
225 views

LibraryFunctionLoad for multivariate C++ function containing several arguments

I've been working on a project for quite a long time, and now when I finally want to use it in praxis I don't know how. I have created a shared library (libcwv.so) with a header (cwv.so) with nvidia'...
1
vote
1answer
55 views

How to use LibraryLink to send an Image OR an Image3D as input? [closed]

The problem I am facing is the following. I need to have as input to my LibraryFunction and 2D or 3D image. Using the following syntax ...
13
votes
2answers
300 views

How to use “managed library expressions” to free the memory?

To return multiple results, Szabolcs (many thanks!) given me a hint in this comment, Namely, using global variable to store the result and then retrieve them with the help of single LibraryLink ...
2
votes
1answer
98 views

How to handle ragged-list type argument in LibraryLink?

Given that I have a ragged list as below, raggedList = {U1, U2, ..., Un} where, ui is a sublist($i=1,2,\cdots,n$) and their ...
3
votes
1answer
146 views

Is it possible to let LibraryLink return multiple results? [duplicate]

I have used the LibraryLink wrapper for some days. In general, there is only one result retruned by the LibraryFunction[]. Below is a simple example: ...
5
votes
0answers
153 views

Is it possible to call a generic dll/so shared library from Mathematica

In Python, there's something called ctypes. With ctypes, one can call any shared library function and get the results back to your script. It supports all kinds of C-language types, such as int, ...
5
votes
1answer
185 views

Why does this LibraryLink function crash?

Recently, I have rewritten pure Wolfram Language implementation CAGDBSplineSurface[] with C. Below is main LibraryLink code: LibraryLink Code ...
1
vote
1answer
163 views

How to call other C function in Wolfram LibraryLink? [closed]

In Wolfram LibrayLink, a C function more or less will call other auxiliary C functions. Below is a instance: In this example, two auxiliary functions FindSpan() ...
7
votes
2answers
143 views

Is it possible to attach a debugger to a dynamically linked library on the supported OS?

Recently, I discovered that LibraryLink technique is a very useful tool to improve the performance of function. Firstly, I need to use LibraryLink template to write C/C++ program. Then compiling the ...
10
votes
3answers
725 views

How to debug the C code for LibraryLink?

Recently, I use the C to rewrite a Mathematica function NonzeroBasis[], please see here for fully descriptions. Here, ...