Jose's Read Only Forum 2023

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Headers, Wrappers, Controls and Tools => Headers => Topic started by: José Roca on February 02, 2009, 03:30:47 AM

Title: GLib - GNOME Library v. 2.18.4
Post by: José Roca on February 02, 2009, 03:30:47 AM
 
GLib is a general-purpose utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on. It works on many UNIX-like platforms, Windows, OS/2 and BeOS. GLib is released under the GNU Library General Public License (GNU LGPL).

The general policy of GLib is that all functions are invisibly threadsafe with the exception of data structure manipulation functions, where, if you have two threads manipulating the same data structure, they must use a lock to synchronize their operation.

Downloads: http://www.gtk.org/download-windows.html
Reference Manual: http://library.gnome.org/devel/glib/

The attached file contains my translation of the GLib headers to PowerBASIC. To use it, add #INCLUDE "GLib.inc" to your program.

The default library name used in the translation is "libglib-2.0-0.dll".


#IF NOT %DEF($GLIB_DLLNAME)
$GLIB_DLLNAME = "libglib-2.0-0.dll"
#ENDIF


If you use a different version or if you want to rename the .dll, change the value in the constant or define a different value for the constant before #INCLUDE "GLib.inc", e.g.


$GLIB_DLLNAME = "glib.dll"
#INCLUDE "GLib.inc"

Title: Re: GLib - GNOME Library v. 2.18.4
Post by: Giancarlo Farigazzi on March 06, 2009, 07:48:38 AM
This problem downloading?
I have very much difficulty
Title: Re: GLib - GNOME Library v. 2.18.4
Post by: José Roca on March 06, 2009, 04:26:11 PM
 
Try again. There are times in which the server is slow, if there is much traffic.
Title: Re: GLib - GNOME Library v. 2.18.4
Post by: James C. Fuller on March 06, 2009, 06:54:15 PM
José,
  Great job on the Glib Header translation.
  I know glib is for primarily for "c" programming but is there another way to declare g_strconcat for Pb. It will only allow one literal string (the first) as it is now?   g_strconcat("/some/path/", "more", ".txt") doesn't work. I Tried changing OPTIONAL ANY to OPIONAL BYREF ASCIIZ but it crashes

James
Title: Re: GLib - GNOME Library v. 2.18.4
Post by: José Roca on March 06, 2009, 07:41:54 PM
Quote
I know glib is for primarily for "c" programming but is there another way to declare g_strconcat for Pb.

Which way? The only way would be to declare them as BYREF ASCIIZ, but as you say it GPFs. Why? I don't know. I declared them AS ANY to force the use of variables to avoid GPFs.

BTW be aware that the last parameter must be BYVAL %NULL, e.g.


' SED_PBCC
#COMPILE EXE
#DIM ALL
#INCLUDE ONCE "glib.inc"

FUNCTION PBMAIN () AS LONG

   LOCAL psz AS ASCIIZ PTR
   LOCAL sz1 AS ASCIIZ * 256
   LOCAL sz2 AS ASCIIZ * 256
   
   sz1 = "more"
   sz2 = ".txt"
   psz = g_strconcat("/some/path/", sz1, sz2, BYVAL %NULL)
   IF psz THEN
      ? @psz
      g_free psz
   END IF

   WAITKEY$

END FUNCTION

Title: Re: GLib - GNOME Library v. 2.18.4
Post by: James C. Fuller on March 07, 2009, 10:53:55 AM
I know the docs say the last should be null but this works just fine.

James


#COMPILE EXE
#DIM ALL
#INCLUDE ONCE "GLIB.INC"

FUNCTION PBMAIN()

LOCAL szPtr AS ASCIIZ PTR
LOCAL sz1,sz2,sz3,sz4 AS ASCIIZ * 10
       sz1 = "James"
sz2 = " C. "
sz3 ="Fuller"
szPtr = g_strconcat(sz1,sz2,sz3)
?@szPtr
        g_free(szptr)

WAITKEY$
END FUNCTION



FWIW this c code works fine. You defiantly need the zero here!!!

#include <stdio.h>
#include <glib.h>
int main(void)
{

    gchar* str;
    str=g_strconcat("James"," C. ","Fuller",0);
    printf("str = %s\n",str);
    getchar();
    return 0;

}


Title: Re: GLib - GNOME Library v. 2.18.4
Post by: Giancarlo Farigazzi on March 09, 2009, 08:38:11 PM
I am same problem
"the archive appears to be damaged or corrupt"
0-bytes on disk
Title: Re: GLib - GNOME Library v. 2.18.4
Post by: José Roca on March 09, 2009, 08:53:28 PM
 
I have tried it just now and I have downloaded it without problems.