Author Topic: GLib - GNOME Library v. 2.18.4  (Read 8448 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
GLib - GNOME Library v. 2.18.4
« 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".

Code: [Select]
#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.

Code: [Select]
$GLIB_DLLNAME = "glib.dll"
#INCLUDE "GLib.inc"
« Last Edit: August 07, 2011, 01:15:47 AM by José Roca »

Offline Giancarlo Farigazzi

  • Newbie
  • *
  • Posts: 2
  • User-Rate: +0/-2
Re: GLib - GNOME Library v. 2.18.4
« Reply #1 on: March 06, 2009, 07:48:38 AM »
This problem downloading?
I have very much difficulty

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: GLib - GNOME Library v. 2.18.4
« Reply #2 on: March 06, 2009, 04:26:11 PM »
 
Try again. There are times in which the server is slow, if there is much traffic.

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Re: GLib - GNOME Library v. 2.18.4
« Reply #3 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

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: GLib - GNOME Library v. 2.18.4
« Reply #4 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.

Code: [Select]
' 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

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Re: GLib - GNOME Library v. 2.18.4
« Reply #5 on: March 07, 2009, 10:53:55 AM »
I know the docs say the last should be null but this works just fine.

James

Code: [Select]
#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!!!
Code: [Select]
#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;

}


Offline Giancarlo Farigazzi

  • Newbie
  • *
  • Posts: 2
  • User-Rate: +0/-2
Re: GLib - GNOME Library v. 2.18.4
« Reply #6 on: March 09, 2009, 08:38:11 PM »
I am same problem
"the archive appears to be damaged or corrupt"
0-bytes on disk

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: GLib - GNOME Library v. 2.18.4
« Reply #7 on: March 09, 2009, 08:53:28 PM »
 
I have tried it just now and I have downloaded it without problems.