4
$\begingroup$

It is useful to know the size of LibraryLink's mint type at compile time, for interoperability with other libraries. For example, should I use the MLPutInteger32 or MLPutInteger64 MathLink call to send a mint?

How can I find out the size of mint at compile time?

$\endgroup$
4
$\begingroup$

The MINT_32 macro will be defined if sizeof(mint) == 4 (i.e. if mint is 32-bit). So simply use

#ifdef MINT_32

...

#endif

It is the CCompilerDriver package that ensures that this macro is defined when necessary, by adding -DMINT_32 to the compiler command. If you compile manually, without using functions like CreateLibrary, it will be your responsibility to define it when appropriate.

$\endgroup$

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.