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 \

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 = \
    compute(libData, num1, &num2);
    printf("%5.2f\\n", num2);

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 :(


  • 1
    $\begingroup$ I doubt that you did not read/see any other posts. And as you can probably tell they are well structured and formatted. Please, head to the help centre for more about code formatting practices and do apply them :) $\endgroup$ – Sektor Nov 22 '14 at 20:15
  • $\begingroup$ I formatted thanx :) $\endgroup$ – TraceKira Nov 22 '14 at 20:38

ITS CRAZY I linked WolframRTL_Minimal.dll instead of WolframRTL.dll and then I put WolframRTL_Minimal.dll in the path where Visual Studio creates the executable :)

Now it works and display 416.16 :)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.