In[15]:= LibraryFunction::libload: The function demo_I_I was not loaded from the file C:\Users\Tom\Dropbox\MathematicaC\knihovna-1\bin\knihovna-1.dll. >>
Out[15]= $Failed
I seems, my poor undestandig how to link a library is not poor, but totaly wrong…
Please, it is possible to tell me shortly, what I am doing wrong and ho to make i correct?
It’s usually less trouble if you install Microsoft’s compiler. It’s possible to install only the command line tools, not the IDE, and it’ll work out of the box with Mathematica. Also, don’t compile using your IDE. Use CreateLibrary[] instead. There are lots of things that can go wrong if the linking isn’t done correctly and CreateLibrary will take care of it for you.
Frank: You are true, my system is 64 bit and the compiller is 32 bit.
Using mingw64 is the behaviour differrent -- the LibraryFunctionLoad remains “hanging” and after Mathematica shutdown, the kernel is still running and must be ended using Taskmanager.
So, the instalation of Microsoft Windows SDK 7.1 failed and it dont understand why. It is too far from Mathematica for me… In this moment I dont now, what more to try.
But this is not a problem fot this dashboard, I think.
There’s the problem. This is C code, but you compiled it with a C++ compiler, which produces different symbols than what Mathematica is trying to load from the shared library.
Put EXTERN_C before each function (where you already have DLLEXPORT). This will expand to extern "C" in C++ mode, which is what is needed to make this work.