Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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. – Martin Aug 18 '13 at 15:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.