On 29-11-2022 15:08, Elizabeth Mattijsen wrote:
Perhaps it would make sense to export these to a separate
Gnome::Constants module?
Wel, I have done that, sort of. The file is generated in the Build phase
of the installation of Gnome::N where I run a C program outputting the
sizes from several C macro definitions. The other types are fixed, like
gboolean and just added to the list. The file is called
Gnome::N::GlibToRakuTypes.
On 29 Nov 2022, at 15:05, Marcel Timmerman <mt1...@gmail.com> wrote:
On 29-11-2022 10:13, Francis Grizzly Smit wrote:
Hi Francis,
Personally I never use \name are I hate how it looks, and so far I
have never needed it, so unless I can find something it can do that
I cannot do any other way, I'll keep on not using it
To show an example where I could use it I have defined a series of
types in the Gnome packages of mine and could then use it everywhere
as a type. The glib has several types defined which I wanted to use
in my code so that I can cut and paste the code from the C source
into Raku source without much changes.
There is a file defined in Gnome::N where a list of types is defined
…
constant \gboolean is export = int32;
constant \gchar is export = int8;
constant \gdouble is export = num64;
constant \gfloat is export = num32;
constant \gint is export = int32;
…
And later in other modules I could then use these definitions, here
for example 'gint'.
…
sub gtk_widget_add_events (
N-GObject $widget, gint $events
) is native(>k-lib)
{ * }
…
The types file is generated to cope with int sizes differing on
several implementations. E.g. a long int could be 32 or 64 bits
depending on the implementation or OS or chip or ….