[Mono-list] Using P/Invoke
Fri, 08 Apr 2005 09:40:31 -0400
Hello, one area I haven't had much practice in with Mono is P/Invoke. I
am trying to import a function from libgimp, so I can use a custom GTK
widget in the library.
Here is what I've tried:
public class GimpColorButton : Button
static extern IntPtr gimp_color_button_new();
public GimpColorButton() : base(IntPtr.Zero)
base.Raw = gimp_color_button_new();
Widget colorButton = new GimpColorButton();
As for the actual Gimp Library, I think maybe multiple libraries have to
be loaded (libgimpcolor, libgimpui, etc.) So maybe I should write a
wrapper C library that links in all the Gimp libraries, and then import
that library into the C#? Regardless of the C library in question, is
the C# above on the right track?