problem with harbour dll

problem with harbour dll

Postby AntoninoP » 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: Select all  Expand view
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?
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: problem with harbour dll

Postby Antonio Linares » Mon Dec 09, 2019 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42061
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: problem with harbour dll

Postby AntoninoP » Mon Dec 09, 2019 7:39 pm

The error is present even with a simple code like:
Code: Select all  Expand view
#include <fivewin.ch>

proc main()
    local i:=1


usually I compile them with hbmk2, with this command line
Code: Select all  Expand view
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"
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: problem with harbour dll

Postby AntoninoP » Tue Dec 10, 2019 1:20 pm

I created a more complete sample.

dll.prg
Code: Select all  Expand view
#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  Expand view
#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  Expand view
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  Expand view
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
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: problem with harbour dll

Postby AntoninoP » Wed Dec 11, 2019 7: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
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 36 guests