Ron, even worse, with latest cvs I get back garbage in ST mode and a series of Chr( 7 ) in MT ?!
ST mode follows -----------8<--------------------- (E:\repos2\xharbour\tests)ref2 99 0 ÓïR ªR`¬RÓ¬R`®RáïR ░Rá®Rá░R`░RáñRáÑRÓ»RáÄRáöRáù RÓûR òR -Rá»Rá8R`»R`%R ------------------------------------ Best regards. Maurilio. Ron Pinkas wrote: > Maurilio, > > The only problem I see is in the sample code - it had a memory > overrun and memory leaks. Here is the corrected sample: > > //---------------------------------------------------------------------- > ------------// > PROCEDURE main() > > LOCAL cStr := "Hello" > > MemoWrit( "test.txt", Replicate( "0", 2048 ) ) > > ? Test() > > fErase( "test.txt" ) > > RETURN > > > PROCEDURE Called( cStr ) > > LOCAL nHandle > > nHandle := fOpen( "test.txt" ) > > ? Len( cStr ) > ? fRead( nHandle, @cStr, Len( cStr ) ) > > fClose( nHandle ) > > RETURN > > > #pragma begindump > > #include <hbapi.h> > #include <hbapiitm.h> > #include <hbvm.h> > > > HB_FUNC( TEST ) > { > PHB_DYNS pSym = hb_dynsymFindName( "CALLED" ); > PHB_ITEM pItem = hb_itemNew( NULL ); > char * pBuffer = NULL; > > pBuffer = (char *) hb_xgrab( 100 ); > hb_itemPutCPtr( pItem, pBuffer, 99 ); // NOTE! > > hb_vmPushSymbol( hb_dynsymSymbol( pSym ) ); > hb_vmPushNil(); > hb_vmPushItemRef( pItem ); > hb_vmDo( 1 ); > > hb_itemReturnForward( pItem ); //NOTE! > hb_itemRelease( pItem ); //NOTE! > } > > #pragma enddump > //---------------------------------------------------------------------- > ------------// > > Ron > > On Jun 20, 2008, at 4:51 AM, Maurilio Longo wrote: > >> Ron, >> >> fRead() has problems when some C code tries to pass to it a >> variable by-reference. >> >> See attached sample, I think this is strictly correlated to my >> previous posts >> about similar issues. >> >> Can this be solved? >> >> Can someone help me find the source of this issue so that I can try >> to fix it >> by myself? >> >> TIA. >> >> Maurilio. >> >> >> -- >> __________ >> | | | |__| Maurilio Longo >> |_|_|_|____| farmaconsult s.r.l. >> >> <ref.prg>------------------------------------------------------------ >> ------------- >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://sourceforge.net/services/buy/ >> index.php_______________________________________________ >> xHarbour-developers mailing list >> xHarbour-developers@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/xharbour-developers > > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > xHarbour-developers mailing list > xHarbour-developers@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/xharbour-developers > -- __________ | | | |__| Maurilio Longo |_|_|_|____| farmaconsult s.r.l. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ xHarbour-developers mailing list xHarbour-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xharbour-developers