New answers tagged

3

http://mathematica.stackexchange.com/a/118739/6804 discusses compiling a library link dll and attaching a debugger. With say Visual Studio, you can just attach to process -> WolframKernel.exe after the dll has been loaded (via LibraryFunctionLoad).


3

Perhaps you need to define MTensor for variable left and right. The modified code is: #include "WolframLibrary.h" DLLEXPORT int NonzeroBasis(WolframLibraryData libData, mint Argc, MArgument *Args, MArgument Res) { /*define the argument-varible*/ mreal saved; mint i, p; mreal u; MTensor tensor_U; mreal *U; /*-------------...


3

Yes, this is possible. In Mathematica print out $ProcessID then in GDB you can use attach to attach to that process id and you should be able to debug.


16

Update: The very likely reason for the garbled error messages is that you have a Chinese version of Visual Studio printing errors in Chinese, and there is a mismatch in the character encoding of these messages and how Mathematica tried to interpret them. CreateLibrary has two very useful options: "ShellCommandFunction" and "ShellOutputFunction". Set ...


8

For me (Windows 10) I get a readable error message like So I add mint saved;. Compiling again I get which leads me to change your MArgument_setReal(Res,tensor_N); to MArgument_setMTensor(Res,tensor_N); and then things work. BTW: I use Needs["CCompilerDriver`"]; srccode=" #include \"WolframLibrary.h\" DLLEXPORT int NonzeroBasis(WolframLibraryData ...


14

First of all, you must be relatively comfortable with the C language. That is absolutely a prerequisite. If you are not comfortable with C, brush up your C skills first. Next, look at concrete examples while reading the LibraryLink user guide. The examples are described in the last section. Start with the simplest ones. The user guide is meant more as ...



Top 50 recent answers are included