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
- How to make a jump difussion graphic
- Calculation issue for LaguerreL in Maple Leaf
- save results of solve in variables
- Streamlines in Mathematica
- How to stop barchart from hiding labels for data value 0 in Mathematica?
- Neural Networks package in Wolfram Mathematica is not Parallel?
- Any efficient easy way to find the maximum list among N lists with the same length using Mathematica?
- Is there any efficient easy way to compare two lists with the same length with Mathematica?
- How to set up Intel C++ Composer XE for Mathematica for Windows?
- Mathematica Graph Editor?
- How to sort N lists by the total sum of elements of each list with Mathematica?
- How to compile Mathematica to C code with intel C++ compiler (x86) on Win7(x64)?
- How to plot a 3d graph starting from a set of points as a ground XY base
- Solve the ODE with NDSolve and dependet variables
- Export data from mathematica script
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 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