New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DClosure implementation #225

dhasenan opened this Issue Jan 7, 2018 · 1 comment


None yet
2 participants

dhasenan commented Jan 7, 2018

There are a number of API functions that accept a gobject.Closure and don't accept a function/callback pair. For example, gtk.AccelGroup.AccelGroup.connect. A few problems with this:

  • D's type system doesn't let me use gobject.CClosure in these locations.
  • The natural way to write these in D is with a delegate. This isn't an option here.
  • I can't access parameters with a gobject.CClosure in any obvious way.
  • I have to cast from eg void function(void* context) to void function(), which is not type-safe.

It would be great to add a way to create an appropriate Closure object.


This comment has been minimized.


MikeWey commented Jan 7, 2018

It look like we need to implement a marshal function to translate an array of GValues into a D function/delegate call. And add a DClosure to hold the function pointer/delegate.

@MikeWey MikeWey self-assigned this Jan 11, 2018

@MikeWey MikeWey closed this in cf75a84 Jan 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment