Is importC ready?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Thu Nov 11 22:30:00 UTC 2021
On Thursday, 11 November 2021 at 22:07:22 UTC, bachmeier wrote:
> preprocessor call, DMD could still change *__restrict to
> *restrict and some of the other fixes. It's already identifying
> those parts of the code so it can ignore them.
Yes, it can do that since the "__" prefix is reserved. But it is
tricky with "_" prefixes as users can use those. Some symbols are
standard library/compiler-dependent and may vary between hardware
targets for the same compiler even?
I think you basically have to choose which specific compiler you
want to emulate if you want a plug&play experience?
Many codebases are written for a specific combination of GCC,
Clang, XCode-Clang, Intel, Microsoft and will fail on all other
compilers. ```#ifdef``` and ```#ifndef``` are used to tailor the
declarations/definitions to each compiler.
I am just saying that it might be difficult to get the *easy*
C-interfacing you hope for, unless you pick one specific compiler
and emulate it well. GCC is probably the best option, but then
you have to pose as GCC to trigger the correct ```#ifdef```. But
GCC has a lot of extensions! Emulating GCC is a difficult
challenge and emulating all compilers is unrealistic.
So, plug&play is not very realistic.
More information about the Digitalmars-d
mailing list