pcode DLL

174 views
Skip to first unread message

Antonio Linares

unread,
Jan 28, 2012, 5:39:54 PM1/28/12
to harbou...@googlegroups.com
Viktor,

I am trying to build a pcode DLL using hbmk2.

pcode1.prg

DYNAMIC Alert

function Another()

   Alert( "From inside the pcode DLL" )

return nil

and call hbmk2 this way:

hbmk2 pcode1.prg -hbdyn -lhbmaindllp.lib

What am I missing ? thanks

Antonio

Antonio Linares

unread,
Jan 28, 2012, 11:14:07 PM1/28/12
to harbou...@googlegroups.com
I got it working this way. Not sure if there is a hbmk2 flag to simplify it:

hbmk2 test1.prg
hbmk2 -hbdyn -lhbmaindllp pcode.prg

test1.prg

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

DYNAMIC Alert

function Another()

   Alert( "Inside the DLL" )

return nil

thanks

Antonio

Rossine

unread,
Jan 30, 2012, 7:57:07 AM1/30/12
to Harbour Developers
Hello Antonio,

Was that you are looking for ?

--- TESPCOD.PRG ---

* hbmk2 -shared tespcod

function Main()

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

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

hb_LibFree( hDLL )

return nil

--- PCODE.PRG ---

* hbmk2 -shared -hbdynvm PCODE

DYNAMIC Alert

function Another()

Alert( "Inside the DLL" )

return nil

Best Regards,

Rossine.

Antonio Linares

unread,
Jan 30, 2012, 5:11:39 PM1/30/12
to harbou...@googlegroups.com
Hello Rossine,

My posted example is working fine. It is a EXE (includes HVM and RTLs) that calls a pcode DLL.  

anyhow thanks for your example, I wasn't aware of the hbmk2 -shared flag to create small pcode EXEs :-)

Reply all
Reply to author
Forward
0 new messages