gtkd-developers / gir-to-d

Create D bindings from GObject introspection files
GNU Lesser General Public License v3.0
23 stars 13 forks source link

functions from handy/c/functions.d are "not defined" #38

Closed JeysonFlores closed 3 years ago

JeysonFlores commented 3 years ago

Hi, I was testing the bindings for libhandy and I started getting some errors when the generated classes call the C-functions constructors. I imported handy.c.functions and called a simple function from it like this:

import handy.c.functions;

void main()
{
    auto a = hdy_window_new();
}

and this fails due to this:

undefined reference to `hdy_window_new'
collect2: error: ld returned 1 exit status

It seems that for some reason it can't call the functions definied in the c/functions.d file. Do you know what is the problem? Thanks!

MikeWey commented 3 years ago

You will need to tell the linker you want to link with libhandy.

alternatively the binding can link with the library dynamically by passing the: --use-runtime-linker to gir-to-d when generating the binding.

JeysonFlores commented 3 years ago

Thanks!