Hi Przemek,
Il 05/02/2009 2.50, Przemyslaw Czerpak ha scritto:
Passing C structures as string is also bad idea.
If we do not need support for direct updating C structure
members at .prg level then it will be enough to introduce
special type of GC pointer to hold all such structures with
basic type veryfication. Below I'm attaching modified code from
message I sent two days ago to xHGtk devel list. It address such
problem.
I have read your post, but I have not understood how I can use your code
passing structures between prg and c code and viceversa.
Could you kindly post an example, also of a simple structure ?
Actually I use structures using cstruct.prg in xhb.
So, using as simple example, passing a point actually I do:
----- prg ------
.....
#include "cstruct.ch"
pragma pack(4)
/* POINT */
typedef struct tagPOINT { ;
LONG x;
LONG y;
} POINT, *PPOINT
.....
METHOD ClientToScreen( x, y )
LOCAL pt := (struct POINT)
LOCAL cBuff
IF PCount() == 2
pt:x := x
pt:y := y
ELSE // x is already a point
pt := x
ENDIF
cBuff := pt:value
XGUI_API_ClientToScreen( ::Handle, @cBuff )
pt:Buffer( cBuff )
RETURN pt
------ c -------
HB_FUNC( XGUI_API_CLIENTTOSCREEN )
{
HWND hWnd = (HWND) hb_parnl( 1 );
POINT * pt = (POINT *) hb_parcx( 2 );
hb_retl( ClientToScreen( hWnd, // handle to window
pt // screen coordinates
) );
}
----------------
Best regards
Francesco
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour