I'm trying to load a C++ function compiled to a shared library from Mathematica 8.0. I did manage to use a C function using MathLink but MathLink does not seem to support C++ functions. So I tried to create a shared library and load it through LibraryLink, but LibraryFunctionLoad does not seem to be able to load a C++ function. Does anyone managed to use a C++ function within Mathematica, and if so, what are the tricks that one have to do to make it work?
Is it possible to load a C++ shared library to Mathematica 8.0?
283 Views Asked by Piotr Korcyl At
1
There are 1 best solutions below
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in MATHEMATICA-8
- Use NFourierTransform to do a two dimensional fourier transformation and plot a picutre(mathematica)
- "DRadialGaussian" is not available as built in function in Mathematica. How can I install package of it in Mathematica
- How can i use Descarta2D package for Mathematica?
- Finding inverse of a matrix using Gauss - Jordan Method
- pivot a group data summary
- computationally expensive Mathematica solver crashes
- Making a histogram out of values from a table
- How to calculate distance from center of a rectangle to sides of the convex hull after rotation?
- Show full calculation in Mathematica to copy into latex
- How do I add numbers to each subset in Wolfram mathematica?
- Pass list element by reference in Mathematica
- Reusing a function expansion by changing variable in Mathematica
- How to generate 6 points on the perimeter of the circle with mathemathica?
- Using LinearModelFit or Predict to attempt a multiple linear regression model in Mathematica
- Streamlines in Mathematica
Related Questions in MATHLINK
- Result from Mathematica in Python via Wolframclient: How to make the result more beautiful?
- MathLinkException C# - Mathematica
- Dyld crash with MathLink framework
- J/Link (MathLink) - evaluateToImage() always returns null
- MathLink not linking to Cocoa project
- Is it possible to load a C++ shared library to Mathematica 8.0?
- CUDA Mathlink in Mathematica 8.0 Not Installing
- The command "nb = NotebookCreate[]" fails within Mathematica?
- Compiling Mathlink Code in Visual Studio 2010 Express LNK2019 Error
- How to use Mathematica functions in Python programs?
- Passing lists from Mathematica to c++ (Mathlink)
- Is it possible to run VB windows applications which used Mathematica .NET/Link, without mathematica?
- REPL (Read–eval–print loop) with Mathlink (Wolfram Mathematica)
- Understanding Kernel-FrontEnd communication -- Why does my Front End freeze?
- How to create C code using Mathlink
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The problem is that the
C++code uses mangling of the symbols being exported.This encodes the namespace, classname, return type, name and parameters as part of the exported symbol. This means that a function called:
exports as something like:
This was done on g++ on linux, windows has a different mangling scheme.
In order to ensure that functions are exported in a C compatible way, you wrap the function in the
extern "C"mechanism, which causes it to be exported in a form that is compatible with MathLinkso you use the following in the header:
As long as you
#includethis header in yourC++implementation, it should link correctly withMathLink