• Welcome to Jose's Read Only Forum 2023.
 

GLib - GNOME Library v. 2.18.4

Started by José Roca, February 02, 2009, 03:30:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca

 
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"


Giancarlo Farigazzi

This problem downloading?
I have very much difficulty

José Roca

 
Try again. There are times in which the server is slow, if there is much traffic.

James C. Fuller

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

José Roca

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


James C. Fuller

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;

}



Giancarlo Farigazzi

I am same problem
"the archive appears to be damaged or corrupt"
0-bytes on disk

José Roca

 
I have tried it just now and I have downloaded it without problems.