On Tue, 12 Feb 2008, Alex Strickland wrote:
> Hello all
> Has anyone ported this file from Harbour?
> The changes to the definition of PHB_DYNS in hbvmpub.h are beyond me 
> to apply to the code.

Just simply use:
      hb_vmPushSymbol( pVALUE->pSymbol );
instead of:
      hb_vmPushDynSym( pVALUE );

Patch below. But after short look I can see serious bug in
this code in usage of hb_parcstruct() function. It returns
pointer to character item stored in hb_stackReturnItem().
But this function is called in a loop so if more then one
C structure will be passed then each next call will clear
previous hb_stackReturnItem() value.

best regards,
Przemek


--- /home/druzus/CVS/xharbour/xharbour/source/rtl/dllcall.c     2007-09-25 
04:55:30.000000000 +0200
+++ dllcall.c   2008-02-12 11:00:04.000000000 +0100
@@ -66,6 +66,7 @@
 #define  WIN32_LEAN_AND_MEAN
 
 #include "hbapiitm.h"
+#include "hbapicls.h"
 
 #if defined( HB_OS_WIN_32 )
 
@@ -99,8 +100,6 @@
 
 HB_EXPORT char * hb_parcstruct( int iParam, ... )
 {
-   HB_THREAD_STUB_ANY
-
    HB_TRACE(HB_TR_DEBUG, ("hb_parcstruct(%d, ...)", iParam));
 
    if( pHB_CSTRUCTURE == NULL )
@@ -141,7 +140,7 @@
 
       if( strncmp( hb_objGetClsName( pItem ), "C Structure", 11 ) == 0 )
       {
-         hb_vmPushSymbol( pVALUE->pSymbol );
+         hb_vmPushDynSym( pVALUE );
          hb_vmPush( pItem );
          hb_vmSend(0);
 
@@ -150,7 +149,7 @@
             hb_itemRelease( pItem );
          }
 
-         return hb_stackReturnItem()->item.asString.value;
+         return hb_parc( -1 );
       }
    }
 
@@ -569,7 +568,7 @@
                case HB_IT_ARRAY             :
                   if( strncmp( hb_objGetClsName( hb_param(i, HB_IT_ANY ) ), "C 
Structure", 11 ) == 0 )
                   {
-                     hb_vmPushSymbol( pDEVALUE->pSymbol );
+                     hb_vmPushDynSym( pDEVALUE );
                      hb_vmPush( hb_param( i, HB_IT_ANY ) );
                      hb_vmSend(0);
 
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to