gtkd-developers / GtkD

GtkD is a D binding and OO wrapper of GTK+ originally created by Antonio Monteiro
http://gtkd.org
Other
322 stars 71 forks source link

Memory allocation failed when compiling with gdc #341

Open Tooniis opened 3 years ago

Tooniis commented 3 years ago

Testing with this small program:

import gtk.Application;

int main(string[] args) {
    Application app = new Application("org.remote.Remote", GApplicationFlags.FLAGS_NONE);

    return app.run(args);
}

It works when compiled with ldc:

$ ldc -I/usr/include/d/gtkd-3 -L-lgtkd-3 main.d
$ ./main

(main:192195): GLib-GIO-WARNING **: 18:50:42.567: Your application does not implement g_application_activate() and has no handlers connected to the 'activate' signal.  It should do one of these.

But when compiled with gdc, it no longer works:

$ gdc -I/usr/include/d/gtkd-3 -lgtkd-3 main.d
$ ./a.out
core.exception.OutOfMemoryError@/build/gcc/src/gcc/libphobos/libdruntime/core/exception.d(705): Memory allocation failed
----------------

Is it just missing some compiler/linker flags, or is there more to it?

MikeWey commented 3 years ago

You will also need to link with libdl by adding -ldl, but this is also needed for ldc, and i would expect a different error.