Creating and using a Harbour pcode DLL

Creating and using a Harbour pcode DLL

Postby Antonio Linares » Sun Jan 29, 2012 4:16 am

go.bat

Code: Select all  Expand view  RUN

set HB_COMPILER=bcc
set path=c:\bcc582\bin
c:\harbour\bin\hbmk2 test1.prg
c:\harbour\bin\hbmk2 -hbdyn -lhbmaindllp pcode.prg
 


test1.prg
Code: Select all  Expand view  RUN

function Main()

   local hDLL := hb_LibLoad( "pcode.dll" )

   Do( "Another" )
   Alert( "From the EXE" )
   
   hb_LibFree( hDLL )

return nil

#pragma BEGINDUMP

#include "hbapi.h"

HB_EXPORT_ATTR PHB_FUNC dll_hb_vmProcAddress( const char * szFuncName )
{
   return hb_vmProcAddress( szFuncName );
}

#pragma ENDDUMP  
 


pcode.prg
Code: Select all  Expand view  RUN

DYNAMIC Alert

function Another()

   Alert( "Inside the DLL" )

return nil
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Creating and using a Harbour pcode DLL

Postby Antonio Linares » Mon Jan 30, 2012 10:02 pm

To create a small EXE that just contains pcode and uses a Harbour DLL that contains the HVM (virtual machine and RTLs) do:

hbmk2 -shared test.prg

test.prg
Code: Select all  Expand view  RUN

function Main()

   Alert( "Hello world" )

return nil
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Creating and using a Harbour pcode DLL

Postby Jimmy » Thu Dec 12, 2019 6:19 am

hi,

i have follow what you wrote and got DLL and a Console Window open ... but no ALERT() :cry:
please have a look if Code is still valid, thx

Question : can i access these DLL from Xbase++ :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1733
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

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