Recently, I discovered that LibraryLink technique is a very useful tool to improve the performance of function. Firstly, I need to use LibraryLink template to write C/C++ program. Then compiling the program to dynamically linked library(i.e. *.dll file) via the CCompilerDriver
package and C compiler. Please see this answer.
If there is no error in your code, the compiling process will successful and no error information occurs. Unfortunately, there will always be some errors/bugs in the code in practice. For instance, today I applied a right algorithm to LibraryLink template to calculate the nonzero values of B-spline basis, but I forgot the variable declaration of saved
, and misuse the MArgument_setReal()
operation.
In this process, I discovered that the debuging is very critical. While the error information that the CreateLibrary[]
given is very limitted. Even if the compiling process is smoothly, the bug maybe exists. Please see Update of that question. Although NonzeroBasis[]
gives me the result, it is wrong and I cannot debug it to find where the error is.
Thank for Albert Retey and Szabolcs's suggestions 1, 2, so I write a new thread here.
- If and how it is possible to attach a debugger to such a dynamically linked library on the supported operating systems?
$ProcessID
can be helpful) and then set a break point in one of your functions. $\endgroup$