CTFE with C functions not possible?
Rikki Cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Dec 31 04:14:32 PST 2015
On 01/01/16 1:11 AM, Shriramana Sharma wrote:
> 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!
As I said its just not possible.
Either port it to D and extern(C) it so it is accesible from other
languages or not have CTFE support.
More information about the Digitalmars-d-learn
mailing list