Is it possible to use CCodeGenerate to generate code which calls functions from other C libraries? For example, I would like to do something like this:

CCodeGenerate[Compile[{{x}}, f[x]+1], "f1"]

where f is a function defined in some other library (which I would then link to the generated code). I tried to first make f available in Mathematica via LibraryLink, but then CCodeGenerate issues a warning (CCodeGenerate::wmreq) and returns $Failed.

  • $\begingroup$ According to Wolfram support "Calling functions from external C libraries is currently not supported by CCodeGenerate. It only supports creation of libraries from the code generated using LibraryGenerate function." I find this rather disappointing. $\endgroup$ – Martin Aug 18 '13 at 15:16

Your Answer

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

Browse other questions tagged or ask your own question.