New answers tagged

5

It seems it is possible. At least I got a toy-example that works. Without having any specific information about this topic from WRI, I always suspected that LibraryLink was not mainly created to give users a way to attach shared library functions to the kernel. I believe that the underlying technology was first used in Compile to make ...


15

Let me give you a very basic example, how you can employ an asynchronously running LibraryLink function for this specific task. I will not do any real packet listen, but only explain the general setup. Usually, a LibraryFunction in Mathematica is written in C and wrapped with a very small boiler plate code that is needed to attach the function directly to ...


1

Thanks to Szabolcs for pointing out the right way. So I rewrite the real Inverse version into complex version, and pasted here for reference. libnewsource="#include<complex> #include<Eigen/Dense> #include<Eigen/LU> #include \"WolframLibrary.h\" DLLEXPORT mint WolframLibrary_getVersion(){return WolframLibraryVersion;} DLLEXPORT int ...


5

LibraryLink's complex type, mcomplex, is defined as two contiguous double values. In C++, std::complex<double> has exactly the same layout. This is guaranteed since C++11, but should hold in most other cases too in practice. This means that if you get a complex array from Mathematica, mcomplex *arr = MTensor_getComplexData(t); then you can ...



Top 50 recent answers are included