I generated the C code: compute.c
#include "math.h"
#include "WolframRTL.h"
static WolframCompileLibrary_Functions funStructCompile;
static mbool initialize = 1;
//#include "compute.h"
DLLEXPORT int Initialize_compute(WolframLibraryData libData)
{
if( initialize)
{
funStructCompile = libData->compileLibraryFunctions;
initialize = 0;
}
return 0;
}
DLLEXPORT void Uninitialize_compute(WolframLibraryData libData)
{
if( !initialize)
{
initialize = 1;
}
}
DLLEXPORT int compute(WolframLibraryData libData, mreal A1, mreal *Res)
{
mreal R0_0;
mreal R0_1;
mreal R0_2;
mreal R0_3;
R0_0 = A1;
R0_1 = R0_0 * R0_0;
R0_2 = sin(R0_1);
R0_3 = R0_1 + R0_2;
*Res = R0_3;
funStructCompile->WolframLibraryData_cleanUp(libData, 1);
return 0;
}
and then compute.h
#include "WolframLibrary.h"
EXTERN_C DLLEXPORT int Initialize_compute(WolframLibraryData libData);
EXTERN_C DLLEXPORT void Uninitialize_compute(WolframLibraryData \
libData);
EXTERN_C DLLEXPORT int compute(WolframLibraryData libData, mreal A1, \
mreal *Res);
Then I build a Visual Studio 2012 Project as compute.dll and then created a second project as standalone exe and linked to it compute.lib and WolframRTL.lib
#include "stdio.h"
#include "compute.h"
void main(int argc, char *arg[])
{
double num1 = 20.4;
double num2;
WolframLibraryData libData = \
WolframLibraryData_new(WolframLibraryVersion);
Initialize_compute(libData);
compute(libData, num1, &num2);
printf("%5.2f\\n", num2);
WolframLibraryData_free(libData);
}
Now I can build it , but when I try to debug it with F5 it says that it cannot start because WolframRTL.DLL is missing from my computer :(
Help