CTFE with C functions not possible?

Shriramana Sharma via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 31 04:11:52 PST 2015

Shriramana Sharma wrote:

> What I desire to do is be able to call a C library from a D template like
> octal to compute a string at compile time.

To be more explicit, I wrote a library in C since it's much leaner size-wise 
than the D code (although admittedly much *much* more tedious to write 
especially with all those string manipulations) and since it's callable from 
other languages like Python too.

None of those other languages have CTFE AFAICS. I would like to provide at 
least the D wrapper to the C library with a template which will enable CTFE 
computation via the library (it's just a string to string conversion). But 
the D compiler is complaining that it cannot call the C function at compile 
time even though the library is installed under /usr/local/lib and Python is 
able to access it via CTypes.

Please help!

Shriramana Sharma, Penguin #395953

More information about the Digitalmars-d-learn mailing list