5 ms·
>The FFI-library of your language can usually call straight into C-functions but then it turns out half of the C API is implemented in macros which can't be cal
by coldtea 7y ago
>The FFI-library of your language can usually call straight into C-functions but then it turns out half of the C API is implemented in macros which can't be called nor converted automatically
Why is that? Aren't the macros expanded by the preprocessor, and end up as a specific piece of code under a function name in a library?
Or does this mean there's no e.g. X function that uses one or more preprocessor macros inside it, but the very X function is but a macro itself (so it's only "callable" by the public API function name, from C code before expansion)?
- buckminster 7y ago> Aren't the macros expanded by the preprocessor, and end up as a specific piece of code under a function name in a library? Sure, but you don't know the name of that function so you can't write the FFI declaration for it. You could reverse engineer it, but this would be platform and compiler specific, so non-portable and unstable.