FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour problem with harbour dll
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
problem with harbour dll
Posted: Mon Dec 09, 2019 10:19 AM
Hello,
I am doing some test to use dynamic dll in harbour inside my code.
I see that to allow the dynamic loading of harbour module I need to build the application with the -shared hbmk2 option active,
But when I try I obtain:
Code (fw): Select all Collapse
FiveHC32.lib(ACTX.obj) : error LNK2019: riferimento al simbolo esterno _hb_gcGripGet non risolto nella funzione _HB_FUN_CREATEACTIVEX
FiveHC32.lib(ACTX.obj) : error LNK2019: riferimento al simbolo esterno _hb_gcGripDrop non risolto nella funzione _HB_FUN_ACTXEND

any hint?
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: problem with harbour dll
Posted: Mon Dec 09, 2019 04:53 PM

Antonino,

Those symbols are exported in hbvm.lib so it is strange that you get that

Could you provide a self contained example to try ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: problem with harbour dll
Posted: Mon Dec 09, 2019 07:39 PM
The error is present even with a simple code like:
Code (fw): Select all Collapse
#include <fivewin.ch>

proc main()
    local i:=1


usually I compile them with hbmk2, with this command line
Code (fw): Select all Collapse
hbmk2 main.prg -Lc:\fwh\lib -Ic:\fwh\include -lfiveh32 -lfivehc32 hbct.hbc xhb.hbc hbmzip.hbc -gui hbziparc.hbc -lversion -lgdiplus -loledlg -ldflag=/NODEFAULTLIB:libcmt

If I add -shared the error appears.

If I try adding trace, I see that the link part changes considerably.
without shared
-nologo -out:main.exe C:\Users\iorpe\AppData\Local\Temp\hbmk_8ahefq.dir\main.obj -libpath:c:\Harbour32\lib\win\msvc -libpath:c:\fwh\lib /NODEFAULTLIB:libcmt -subsystem:windows fiveh32.lib fivehc32.lib hbct.lib xhb.lib hbtip.lib hbfship.lib hbxpp.lib hbwin.lib png.lib hbmzip.lib minizip.lib hbziparc.lib version.lib gdiplus.lib oledlg.lib hbextern.lib hbdebug.lib hbvm.lib hbrtl.lib hblang.lib hbcpage.lib gtcgi.lib gtpca.lib gtstd.lib gtwin.lib gtwvt.lib gtgui.lib hbrdd.lib hbuddall.lib hbusrrdd.lib rddntx.lib rddcdx.lib rddnsx.lib rddfpt.lib hbrdd.lib hbhsx.lib hbsix.lib hbmacro.lib hbcplr.lib hbpp.lib hbcommon.lib winmm.lib kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib iphlpapi.lib winspool.lib comctl32.lib comdlg32.lib shell32.lib uuid.lib ole32.lib oleaut32.lib mpr.lib mapi32.lib imm32.lib msimg32.lib wininet.lib hbpcre.lib hbzlib.lib


with shared
-nologo -out:main.exe C:\Users\iorpe\AppData\Local\Temp\hbmk_bhxtdw.dir\main.obj -libpath:c:\Harbour32\lib\win\msvc -libpath:c:\fwh\lib /NODEFAULTLIB:libcmt -subsystem:windows fiveh32.lib fivehc32.lib hbct.lib xhb.lib hbtip.lib hbfship.lib hbxpp.lib hbwin.lib png.lib hbmzip.lib minizip.lib hbziparc.lib version.lib gdiplus.lib oledlg.lib hbmainstd.lib hbmainwin.lib hbcplr.lib hbdebug.lib winmm.lib kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib iphlpapi.lib winspool.lib comctl32.lib comdlg32.lib shell32.lib uuid.lib ole32.lib oleaut32.lib mpr.lib mapi32.lib imm32.lib msimg32.lib wininet.lib "harbour-32.lib"
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: problem with harbour dll
Posted: Tue Dec 10, 2019 01:20 PM
I created a more complete sample.

dll.prg
Code (fw): Select all Collapse
#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 (fw): Select all Collapse
#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 (bat): Select all Collapse
<div id="{CB}" style="font-family: monospace;">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</div>


It works, but the output contains:
Code (dos): Select all Collapse
<div class="dos" id="{CB}" style="font-family: monospace;">hbmk2: Link <a href="http://www.ss64.com/nt/in.html">in</a> corso di... main.exe
FiveHC32.lib(ACTX.obj) : error LNK2019: unresolved external symbol _hb_gcGripGet referenced <a href="http://www.ss64.com/nt/in.html">in</a> function _HB_FUN_CREATEACTIVEX
FiveHC32.lib(ACTX.obj) : error LNK2019: unresolved external symbol _hb_gcGripDrop referenced <a href="http://www.ss64.com/nt/in.html">in</a> function _HB_FUN_ACTXEND
main.exe : warning LNK4088: image being generated due to /force option image may <a href="http://www.ss64.com/nt/not.html">not</a> run</div>
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: problem with harbour dll
Posted: Wed Dec 11, 2019 07:52 AM
What I want to do was already treaty
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=23372
and in other Spanish threads, that I don't understand

Continue the discussion