Calling a PRG function from C code

Calling a PRG function from C code

Postby Antonio Linares » Mon Nov 09, 2009 9:05 am

A working example:
Code: Select all  Expand view
function Main()

   Test()

return nil

function Another( cText )

   MsgInfo( cText, "From Another()" )

return "a string"

#pragma BEGINDUMP

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

HB_FUNC( TEST )
{
  hb_vmPushSymbol( hb_dynsymGetSymbol( "ANOTHER" ) );
  hb_vmPushNil();
  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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 111 guests