Hi, On 2010 Jan 31, at 03:06, Leandro Damasio wrote:
>> I can't recommend doing that in any application as >> these are not guaranteed interfaces/structures, plus >> it may cause several other problems (alignment >> dependence, corrupting VM internals, MT/ST mode >> dependence, code breaking when Harbour internals >> happen to change). > > ok Viktor, I see. That's what happened indeed. > >> So my suggestion it to use the documented Harbour >> C API. You can find these in hbapi*.h headers for >> the most part. > > Sure. Could you tell me how to do the following through the C API? > > 1) get the length of the array, instead of method below: > > PHB_BASEARRAY pBaseArray = pArray->item.asArray.value; > ULONG ulLen = pBaseArray->ulLen ; hb_arrayLen( pArray ) > 2) eval a codeblock with a member of the array as a parameter and get the > return of the block, instead of the following: > HB_STACK_TLS_PRELOAD Never needed in user code. > hb_vmPushSymbol( &hb_symEval ); > hb_vmPush( pBlock ); > hb_vmPush( pBaseArray->pItems + ulPosition ); hb_arrayGetItemPtr( ulPosition + 1 ) > hb_vmPushLong( ulPosition ); > hb_vmSend( 2 ); > pItem = (PHB_ITEM) hb_stackReturnItem(); Rest should work, though if you need more eval examples, I'd recommend grepping into Harbour contrib or core (except VM) source code, you'll find plenty of working examples. Brgds, Viktor _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour