Using D libs in C

Dainius (GreatEmerald) pastas4 at gmail.com
Sun Mar 20 09:31:30 PDT 2011


Now I'm trying to do something more complicated, and it seems that while
importing works (it compiles and links fine), actually using the imported
things or pretty much anything that D offers makes the program crash. For
instance, in the D part:

-------------------
module dpart;
import std.stdio;

version(linux)
{
    int main()
    {
        return 0;
    }
}

extern(C):
shared int ResultD;

int Process(int Value)
{
    writeln("hai"); //<- Hangs here
    printf("You have sent the value %d to the D library.\n", Value);
    ResultD = (Value % 5);
    string a; //Doesn't hang
    a = "10";//Doesn't hang
    printf("String %s", a); //<- Hangs here
    return ResultD;
}
-------------------

There is no readable error, just your ordinary program crash "report this to
Microsoft"... Any idea why it's like that?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20110320/a600fd9a/attachment.html>


More information about the Digitalmars-d-learn mailing list