I have used the LibraryLink technique for about 3 months. In this process, the code of my project became more and more larger(about 50 LibraryLink wrapper functions, 5000 lines ANCI C code). In my project, I just use a simple *.c
file to organize it as follows:
#include " WolframLibrary.h"
/*Part 0 including head files*/
#include <math.h>
#include <stdlib.h>
#include <xxx.h>
/*Part 1: functions declaration*/
int func1(int a, int b);
xxx();
/*Part 2: LibraryLink wraper functions*/
DLLEXPORT int func1(WolframLibraryData libData, mint Argc, MArgument *Args, MArgument Res){}
DLLEXPORT int func2(WolframLibraryData libData, mint Argc, MArgument *Args, MArgument Res){}
/*Part 3: auxiliary function for LibraryLink functions*/
int func1(int a, int b){}
void func2(int a, int b){}
when I need to compile it, I used the following method:
Copy the total code to Mathematica notebook with src=code_of_file
, and compile it with CreateLibrary[src, "lib_link"]
However, the code is very large(5000-10000 lines), so it it not easy to maintain and organize. So I would like to know:
- Is there good method to deal with problem?