I created a more complete sample.
dll.prg
Code: Select all
#include <fivewin.ch>
DYNAMIC FW_GT
DYNAMIC MsgInfo
DYNAMIC TWindow
DYNAMIC TSay
proc Function1()
MsgInfo("Hello from Dll1")
proc Function2(oParent)
LOCAL oWnd, oSay
DEFINE WINDOW oWnd OF oParent
@ 1,1 SAY oSay PROMPT "Hello from Dll2"
ACTIVATE WINDOW oWnd
main.prg
Code: Select all
#include <fivewin.ch>
DYNAMIC Function1
DYNAMIC Function2
proc main()
LOCAL oWnd, pDll
CoInitialize()
pDll := HB_LibLoad( "dll.dll" )
DEFINE WINDOW oWnd
@ 1,1 BUTTON "Test1" ACTION iif(type("Function1()")=="UI",Function1(),MsgInfo("Function1 not found"))
@ 3,1 BUTTON "Test2" ACTION iif(type("Function2()")=="UI",Function2(),MsgInfo("Function2 not found"))
ACTIVATE WINDOW oWnd
then build them with
Code: Select all
set FWH_INSTALL=c:\fwh32
hbmk2 dll.prg -i${FWH_INSTALL}\include -hbdynvm -shared -inc
hbmk2 main.prg -hbexe -gui -i${FWH_INSTALL}\include -L${FWH_INSTALL}\lib -lFiveH32 -lFiveHC32 -lVersion -lOleDlg -lGdiplus -ldflag=/NODEFAULTLIB:libcmt xhb.hbc hbziparc.hbc -shared -ldflag=/force -inc
It works, but the output contains:
Code: Select all
hbmk2: Link in corso di... main.exe
FiveHC32.lib(ACTX.obj) : error LNK2019: unresolved external symbol _hb_gcGripGet referenced in function _HB_FUN_CREATEACTIVEX
FiveHC32.lib(ACTX.obj) : error LNK2019: unresolved external symbol _hb_gcGripDrop referenced in function _HB_FUN_ACTXEND
main.exe : warning LNK4088: image being generated due to /force option image may not run