Group Abstract Group Abstract

Message Boards Message Boards

Finding the mdefs.h C header file to utilize Cform function output

I am using Mathematica to do proof of concept work with some computational physics simulations. The goal being to scale up these simulations in C. The Cform[] output for my Mathematica Cells is very valuable, however, when looking online for how to use the the need macros I find that I need the mdefs.h file library to link my code to. I have not been able to located it? Where can I search or do I need to download a developer kit seperatly? I am using a Mac with Mathematica 13.2.

POSTED BY: Ed di Girolamo
4 Replies

Do you have an example of such a macro? Keep in mind that the scope of CForm is very limited, it only understands a tiny subset of the language and in most cases its output will not actually be compilable C code. See also the C code generation tutorial in the documentation for what is feasible in terms of generated code (interpolating functions are definitely not).

POSTED BY: Ilian Gachevski

Try evaluating FileNames["mdefs.h", $InstallationDirectory, Infinity]

POSTED BY: Ilian Gachevski

I have been attempting to try various simple functions but the C code generation tutorial will help me sort it out for my next actual project. Thank you for that resource and link!

POSTED BY: Ed di Girolamo
POSTED BY: Ed di Girolamo
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard