problem with harbour dll

Post Reply
AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

problem with harbour dll

Post by AntoninoP »

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

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?
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: problem with harbour dll

Post by Antonio Linares »

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
AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: problem with harbour dll

Post by AntoninoP »

The error is present even with a simple code like:

Code: Select all

#include <fivewin.ch>

proc main()
    local i:=1
usually I compile them with hbmk2, with this command line

Code: Select all

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: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: problem with harbour dll

Post by AntoninoP »

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
AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: problem with harbour dll

Post by AntoninoP »

What I want to do was already treaty
http://forums.fivetechsupport.com/viewt ... =3&t=23372
and in other Spanish threads, that I don't understand
Post Reply