Calling a PRG Method from C code

Post Reply
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Calling a PRG Method from C code

Post by Antonio Linares »

A working example:

Code: Select all

#include "hbclass.ch"

function Main()

   local o := MyClass():New()

   Test( o )

return nil

CLASS MyClass

   METHOD New() INLINE Self

   METHOD Another( cText ) INLINE MsgInfo( cText ), "a string"

ENDCLASS

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>
#include <hbvm.h>

HB_FUNC( TEST )
{
  hb_vmPushSymbol( hb_dynsymGetSymbol( "ANOTHER" ) );
  hb_vmPush( hb_param( 1, HB_IT_OBJECT ) );
  hb_vmPushString( "PRG level from C", strlen( "PRG level from C" ) );
  hb_vmFunction( 1 );   
  
  MessageBox( 0, "return code from PRG", hb_parc( -1 ), 0 );
}

#pragma ENDDUMP   
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
toninhofwi
Posts: 161
Joined: Tue Oct 18, 2005 10:01 am

Re: Calling a PRG Method from C code

Post by toninhofwi »

Thank you
Post Reply