SIGSEGV when using D DLL with Qt MinGW

Jerry via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 23 00:50:45 PST 2016


Hello guys, as the title says I'm getting a SIGSEGV when trying 
to use a D DLL.

Let's take a look on this C++ code:


extern "C" __declspec(dllimport) void D_user_fillEngine(const 
char* workDir, void* engine);
extern "C" __declspec(dllimport) int D_user_startUp();
extern "C" __declspec(dllimport) int D_user_terminate();

int main(int argc, char *argv[])
{
     D_user_startUp();
     D_user_fillEngine("path", nullptr);
     QApplication app(argc, argv);

     QQmlApplicationEngine engine;
     engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

     int res = app.exec();
     D_user_terminate();
     return res;
}


Just normal Qt startup code with some external DLL 
loading/calling by OS.
The D_user_* calls just have to be there to cause the SIGSEGV, 
not being executed. So I guess something is wrong with the way 
this DLL is loaded.

And the D code:

export extern(C) void D_user_fillEngine(char* c_workDir, void* 
c_qmlEngine) {
      //Foo
}

export extern(C) int D_user_startUp() {
      //Intended for rt_init();
}

export extern(C) int D_user_terminate() {
     //Intended for rt_term();
}


I am using the following environment:

Windows 7
Qt 5.5
MinGW 4.9
DMD 2.69.1
DUB (with dynamicLibrary option)

Everything is x86.

I am really stuck here. Thanks on beforehand.


More information about the Digitalmars-d-learn mailing list