On 1/18/13, nazriel <s...@dzfl.pl> wrote:
> extern(C) void _D3lib3fooFZv();
>
> void main() {
>       _D3lib3fooFZv();
> }

That's a *terrible* idea, you are calling a D function using the C
convention, you're going to have all sorts of problems. extern(D) is
not just used for mangling, it's also used for designating how
parameters are passed to and results are returned from a function (via
stack/registers). E.g.:

import std.stdio;

int foo(int x, int y)
{
    return x + y;
}

alias extern(C) int function(int, int) Func;

void main()
{
    Func func = cast(Func)&foo;
    writeln(func(1, 2));
}

$ rdmd test.d
> object.Error: Access Violation

Reply via email to