[gtkada] Problem writing a librsvg Ada binding

Dmitry A. Kazakov mailbox at dmitry-kazakov.de
Thu Dec 28 10:54:09 CET 2006


On Wed, 27 Dec 2006 23:39:30 +0100, you wrote:

> I'm trying to write a librsvg Ada binding and have a problem with it.

[...]
> package RSVG is
> 
>    -- ...
> 
>    type RSVG_Handle_Record is new Glib.Object.GObject_Record with private;
>    type RSVG_Handle is access all RSVG_Handle_Record'Class;
> 
>    -- ...
> 
>    procedure SRVG_New_From_File
>      (Handle   : out RSVG_Handle;
>       Filename : String;
>       Error    : out GError);
> 
>    -- ...
> 
> private
>    -- ...
>    type RSVG_Handle_Record is new Glib.Object.GObject_Record with null 
> record;
> end RSVG;
> --------------------------------------------------------------
> 
> The implementation of SRVG_New_From_File is:
> 
> --------------------------------------------------------------
>    procedure SRVG_New_From_File
>      (Handle   : out RSVG_Handle;
>       Filename : String;
>       Error    : out GError)
>    is
>       function Internal (Filename : System.Address; Error : access 
> GError) return System.Address;
>       pragma Import (C, Internal, "rsvg_handle_new_from_file");
>       C_Filename : constant String := Filename & ASCII.nul;
>       Err : aliased GError;
>    begin
>       Handle := new RSVG_Handle_Record;
>       Set_Object (Handle, Internal (C_Filename'Address, Err'Access));

I guess the corresponding GTK+ type object must be once created and
registered before you do Set_Object. I mean Register_Static and all that
stuff.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



More information about the gtkada mailing list