Dne 20.12.2011 0:02, Trass3r napsal(a):
Am 19.12.2011, 23:13 Uhr, schrieb Martin Drašar <[email protected]>:

Dne 19.12.2011 23:09, Trass3r napsal(a):
It actualy returns a procedure address and the procedure is called. It
lands inside export extern (C) int magicNumber() and crashes when
attempting to allocate memory for Something.

Did you properly initialize druntime?

As I am just starting with D, the most precise answer I can give you
is: I don't know... how do I tell? Or in another way - the code for D
library is almost complete except for imports. The rest was done for
me by Visual D.

It's explained there: http://www.dlang.org/dll.html


Well as far as I can tell, the runtime is initialized with call to Runtime.initialize(). This call is executed inside dll_process_attach here:

extern (Windows)
BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
{
    final switch (ulReason)
    {
    case DLL_PROCESS_ATTACH:
        g_hInst = hInstance;
        dll_process_attach( hInstance, true );
        break;

so I would say that the runtime is properly initialized.

Martin

Reply via email to