Maurilio, Below is a working, reduced, self contained, sample:
[FWIW, HB_IsByRef() has been broken since latest synch with Harbour's item api. It will have to implemented as PCODE in order to be fixed. Ron PROCEDURE Main() Test() RETURN PROCEDURE CallBack( cBuff ) ? cBuff ? cBuff := "Changed" RETURN #pragma BEGINDUMP #include "hbapiitm.h" #include "hbvm.h" #include "hbfast.h" #define BUFFER_LEN 10 int Callback( char *szBuff, int iLen ); HB_FUNC( TEST ) { char *szBuff = (char *) malloc( BUFFER_LEN + 1 ); memset( szBuff, '\0', BUFFER_LEN + 1 ); memcpy( szBuff, "Original", 8 ); Callback( szBuff, BUFFER_LEN ); printf( "%s\n", szBuff ); } int Callback( char *szBuff, int iLen ) { PHB_ITEM pString = hb_itemPutCLStatic( NULL, szBuff, iLen ); hb_vmPushSymbol( hb_dynsymSymbol( hb_dynsymFindName ( "CALLBACK" ) ) ); hb_vmPushNil(); hb_vmPushItemRef( pString ); hb_vmDo( 1 ); if( hb_itemGetCPtr( pString ) != szBuff ) { if( iLen > hb_itemGetCLen( pString ) ) { iLen = hb_itemGetCLen( pString ); } memcpy( szBuff, hb_itemGetCPtr( pString ), iLen ); szBuff[ iLen ] = '\0'; } hb_itemRelease( pString ); return 0; } #pragma BEGINDUMP ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ xHarbour-developers mailing list xHarbour-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xharbour-developers