Cada actualización a un nuevo PCODE de xHarbour es como parir un erizo (puerco espín). Tengo manía y dependencia total de código contenido en DLL´s. Cada cambio en xHarbour desbaratan lo que antes funcionaba. Qué locura.
Todas mis Dll´s son autocontenidas (pueden usarse desde cualquier EXE, escrito en cualquier lenguaje).
Ahora, con xHarbour 1.2.1 PCode Versión 10 ya no funcionan más.
He buscado por todo el foro así como en el de xHarbour y no encuentro solución.
Si en el bat de generación de la DLL se agrega Harbour.lib funciona, pero la DLL no contiene la VM de xHarbour. Ejecuta el código contenido de la DLL, recibe y devuelve parámetros, etc.
Si quito Harbour.lib, SI contiene la VM, pero NO ejecuta el código contenido en la DLL, aunque devuelve parámetros.
Aquí va el código de prueba con FWH 9.08, xHarbour 1.2.1 y Borland 5.5
Código de la DLL, PruDll.prg:
- Code: Select all Expand view
- #include "\FWH-908\INCLUDE\FiveWin.ch"
FUNCTION DllFunc1()
local cLaResp:="Dato retornado desde la DLL, Function DllFunc1()"
MsgInfo("Estamos dentro de la DLL, en Function DllFunc1()")
PUBLIC cVar1:="cVar 1 creada en DllFunc1"
PRIVATE cVar2:="Creada en DllFunc y será usada en DllFunc2()"
DllFunc2()
RETURN(cLaResp)
Procedure DllFunc2
MsgInfo("Dentro de DllFunc2() leemos la cVar2 que es PRIVATE y creada en DllFunc1: "+cVar2)
Return
Código del Programa Principal, Prueba1.prg:
- Code: Select all Expand view
- #include "\FWH-908\INCLUDE\FiveWin.ch"
Function Inicio()
local cResp:= Space(100)
//local hDll := libLoad( "prudll.dll" )
localhDll := LoadLibrary( "prudll.dll" )
cResp:=HB_LibDo("DllFunc1")
MsgInfo(cResp)
MsgInfo(cVar1)
Return(NIL)
Bat de generación de la DLL:
- Code: Select all Expand view
@echo off
set hdir=c:\xHarbour-20090921
set bcdir=c:\Borland
%hdir%\bin\harbour fwhstub /n /w /es2 /gc0
if errorlevel 1 goto end
bcc32 -M -c -O2 -tWM -D__HARBOUR__ -I%hdir%\include fwhstub.c
if errorlevel 1 goto end
if exist fwhstub.lib del fwhstub.lib
tlib fwhstub +fwhstub, fwhstub
if errorlevel 1 goto end
%bcdir%\bin\bcc32 -M -c -O2 -tWD -D__HARBOUR__ -w-nak -D__EXPORT__ -n%hdir%\lib -I%hdir%\include %hdir%\source\vm\maindllp.c
if errorlevel 1 goto end
if exist %1.dll del %1.dll
%hdir%\bin\harbour %1 /n /vd /gc0 /D__EXPORT__ >> CLIP.LOG
if errorlevel 1 goto end
%bcdir%\bin\bcc32 -M -c -O2 -tWD -D__HARBOUR__ -w-nak -D__EXPORT__ -o%1 -I%hdir%\include %1.c
if errorlevel 1 goto end
@echo c0d32w.obj + > hdll.bc
@echo %1.obj, + >> hdll.bc
@echo %1.DLL, + >> hdll.bc
@echo %1.map, + >> hdll.bc
@echo fwhstub.lib + >> hdll.bc
@echo c:\fwh-908\libX\FiveHX.lib c:\fwh-908\lib\FiveHC.lib + >> hdll.bc
@echo %hdir%\lib\maindllp.obj + >> hdll.bc
rem @echo %hdir%\lib\DllMain.lib + >> hdll.bc
@echo %hdir%\lib\Harbour.lib + >> hdll.bc
@echo %hdir%\lib\rtl.lib + >> hdll.bc
@echo %hdir%\lib\vm.lib + >> hdll.bc
@echo %hdir%\lib\gtgui.lib + >> hdll.bc
@echo %hdir%\lib\lang.lib + >> hdll.bc
@echo %hdir%\lib\macro.lib + >> hdll.bc
@echo %hdir%\lib\rdd.lib + >> hdll.bc
@echo %hdir%\lib\dbfntx.lib + >> hdll.bc
@echo %hdir%\lib\dbfcdx.lib + >> hdll.bc
@echo %hdir%\lib\dbffpt.lib + >> hdll.bc
@echo %hdir%\lib\hbsix.lib + >> hdll.bc
@echo %hdir%\lib\debug.lib + >> hdll.bc
@echo %hdir%\lib\common.lib + >> hdll.bc
@echo %hdir%\lib\pp.lib + >> hdll.bc
@echo %hdir%\lib\PCREPOS.lib + >> hdll.bc
@echo %hdir%\lib\Ace32.lib + >> hdll.bc
@echo %bcdir%\lib\cw32.lib + >> hdll.bc
@echo %bcdir%\lib\import32.lib + >> hdll.bc
@echo %bcdir%\lib\psdk\odbc32.lib, >> hdll.bc
%bcdir%\bin\ilink32 -Gn -aa -Tpd -s @hdll.bc > LINK.LOG
if errorlevel 1 goto end
:end
@echo off
if exist %1.lib del %1.lib
if exist *.tds del *.tds
if exist *.c del *.c
if exist *.def del *.def
if exist *.map del *.map
if exist %1.obj del %1.obj
if exist *.lst del *.lst
if exist fwhstub.obj del fwhstub.obj
if exist fwhstub.lib del fwhstub.lib
set hdir=
set bcdir=
Bat de compilación y linkeo del programa principal:
- Code: Select all Expand view
##############################################################################
# Template make file for FWH and Borland Make tool #
# Copyright FiveTech 2002 #
# Use: bmake.bat <your_make_file> #
##############################################################################
# Win2000 bug ################################################################
# Uncomment next line if you receive any DEL error ###########################
# set DEL=cmd /c del
!if !$d(DEL)
DEL = del
!endif
# Make directives ############################################################
.autodepend
.swap
.suffixes: .prg .hrb
# Flags for modules to include: YES | NO (must be UPPERCASE)##################
RES_FILE = NO
LNK_DBFNTX = YES
LNK_DBFCDX = YES
LNK_DEBUG = NO
LNK_ADVANTAGE = YES
LNK_ODBC = NO
MAP_FILE = NO
# Application directories & filenames ########################################
APP_NAME = PRUEBA1 # (Your EXE name without extension)
APP_PRG_DIR = .
APP_OBJ_DIR = . # (create the app\obj directory first)
APP_INCLUDE_DIR = .
APP_EXE_DIR = $(APP_PRG_DIR)
APP_RES_DIR = $(APP_PRG_DIR)
APP_EXE = $(APP_EXE_DIR)\$(APP_NAME).EXE
APP_RC = $(APP_RES_DIR)\$(APP_NAME).rc
APP_RES = $(APP_RES_DIR)\$(APP_NAME).res
APP_MAP = $(APP_RES_DIR)\$(APP_NAME).map
# Paths for dependent files ##################################################
.path.prg = $(APP_PRG_DIR)
.path.hrb = $(APP_OBJ_DIR)
.path.obj = $(APP_OBJ_DIR)
# Application PRG files (your PRG files go here) #############################
APP_PRG_LIST = \
PRUEBA1.prg \
# Contruction of the rest dependency lists ###################################
APP_PRGS = $(APP_PRG_LIST)
APP_HRBS = $(APP_PRG_LIST:.prg=.hrb)
APP_OBJS = $(APP_PRG_LIST:.prg=.obj)
# Fivewin directories ########################################################
FIVEWIN_INCLUDE_DIR = c:\fwh-908\include
FIVEWIN_LIB_DIR = c:\fwh-908\lib
# Fivewin libraries ##########################################################
FIVE_LIB = c:\fwh-908\libX\fiveHX.lib
##FIVE_LIB = $(FIVEWIN_LIB_DIR)\fiveHX.lib
FIVEC_LIB = $(FIVEWIN_LIB_DIR)\fiveHC.lib
# Harbour directories & flags ################################################
HARBOUR_INCLUDE_DIR = c:\Xharbour-20090921\include
HARBOUR_EXE_DIR = c:\Xharbour-20090921\bin
HARBOUR_LIB_DIR = c:\Xharbour-20090921\lib
HARBOUR_FLAGS = -i$(APP_INCLUDE_DIR);$(FIVEWIN_INCLUDE_DIR);$(HARBOUR_INCLUDE_DIR) -n -m -w -P -D__IMPORT__ -D__CONFWH908__ > comp.log
HARBOUR_EXE = $(HARBOUR_EXE_DIR)\harbour.exe
# Harbour libraries ##########################################################
OPT_GUI = $(HARBOUR_LIB_DIR)\optgui.lib
RTL_LIB = $(HARBOUR_LIB_DIR)\rtl.lib
VM_LIB = $(HARBOUR_LIB_DIR)\vm.lib
###GTWIN_LIB = $(HARBOUR_LIB_DIR)\gtWin.lib
GTWIN_LIB = $(HARBOUR_LIB_DIR)\gtgui.lib
LANG_LIB = $(HARBOUR_LIB_DIR)\lang.lib
MACRO_LIB = $(HARBOUR_LIB_DIR)\macro.lib
RDD_LIB = $(HARBOUR_LIB_DIR)\rdd.lib
DBFNTX_LIB = $(HARBOUR_LIB_DIR)\dbfntx.lib
DBFCDX_LIB = $(HARBOUR_LIB_DIR)\dbfcdx.lib
HBCOMM_LIB = $(HARBOUR_LIB_DIR)\hbcomm.lib
DEBUG_LIB = $(HARBOUR_LIB_DIR)\debug.lib
COMMON_LIB = $(HARBOUR_LIB_DIR)\common.lib
PP_LIB = $(HARBOUR_LIB_DIR)\pp.lib
MISC_LIB = $(HARBOUR_LIB_DIR)\libmisc.lib
NANF_LIB = $(HARBOUR_LIB_DIR)\libnf.lib
DBFFPT_LIB = $(HARBOUR_LIB_DIR)\dbffpt.lib
HBSIX_LIB = $(HARBOUR_LIB_DIR)\hbsix.lib
PCREP_LIB = $(HARBOUR_LIB_DIR)\pcrepos.lib
# Advantage libraries ########################################################
RDDADS_LIB = $(HARBOUR_LIB_DIR)\rddads.lib
ACE32_LIB = $(FIVEWIN_LIB_DIR)\ace32.lib
# Borlanc directories & flags ################################################
BORLANDC_INCLUDE_DIR = c:\Borland\include
BORLANDC_EXE_DIR = c:\Borland\bin
BORLANDC_LIB_DIR = c:\Borland\lib
BORLANDC_COMP_FLAGS = -c -O2 -D__IMPORT__ -I$(HARBOUR_INCLUDE_DIR);$(BORLANDC_INCLUDE_DIR)
BORLANDC_COMP_EXE = $(BORLANDC_EXE_DIR)\bcc32.exe
BORLANDC_LINK_FLAGS = -Gn -aa -Tpe -s -I$(APP_OBJ_DIR) -D__IMPORT__ > link1.log
BORLANDC_LINK_EXE = $(BORLANDC_EXE_DIR)\ilink32.exe
BORLANDC_RES_EXE = $(BORLANDC_EXE_DIR)\brc32.exe
!if $(MAP_FILE) != YES
BORLANDC_LINK_FLAGS = $(BORLANDC_LINK_FLAGS) -x
!endif
# Borland libraries & files ##################################################
STARTUP_OBJ = $(BORLANDC_LIB_DIR)\c0w32.obj
CW32_LIB = $(BORLANDC_LIB_DIR)\cw32.lib
IMPORT32_LIB = $(BORLANDC_LIB_DIR)\import32.lib
ODBC32_LIB = $(BORLANDC_LIB_DIR)\psdk\odbc32.lib
LIB_BORL01 = $(BORLANDC_LIB_DIR)\psdk\rasapi32.lib
LIB_BORL02 = $(BORLANDC_LIB_DIR)\psdk\nddeapi.lib
LIB_BORL03 = $(BORLANDC_LIB_DIR)\psdk\msimg32.lib
LIB_BORL04 = $(BORLANDC_LIB_DIR)\psdk\iphlpapi.lib
# Dependencies ###############################################################
all: $(APP_OBJS) $(APP_HRBS) $(APP_EXE)
!if $(RES_FILE) == YES
all: $(APP_RES)
!endif
# Implicit Rules #############################################################
.prg.hrb:
$(HARBOUR_EXE) $(HARBOUR_FLAGS) $** -o$@
.hrb.obj:
$(BORLANDC_COMP_EXE) $(BORLANDC_COMP_FLAGS) -o$@ $**
# Explicit Rules #############################################################
!if $(RES_FILE) == YES
$(APP_RES) : $(APP_RC)
$(BORLANDC_RES_EXE) -r $**
$(APP_EXE) :: $(APP_RES)
@if exist $(APP_EXE) $(DEL) $(APP_EXE) > nul
!endif
$(APP_EXE) :: $(APP_OBJS)
$(BORLANDC_LINK_EXE) $(BORLANDC_LINK_FLAGS) @&&|
$(STARTUP_OBJ) +
$(**), +
$(APP_EXE), +
$(APP_MAP), +
$(FIVE_LIB) +
$(FIVEC_LIB) +
$(RTL_LIB) +
$(VM_LIB) +
$(GTWIN_LIB) +
$(LANG_LIB) +
$(MACRO_LIB) +
$(RDD_LIB) +
$(HBCOMM_LIB) +
$(MISC_LIB) +
$(NANF_LIB) +
!if $(LNK_DBFNTX) == YES
$(DBFNTX_LIB) +
!endif
!if $(LNK_DBFCDX) == YES
$(DBFCDX_LIB) +
!endif
$(DBFFPT_LIB) +
$(HBSIX_LIB) +
!if $(LNK_DEBUG) == YES
$(DEBUG_LIB) +
!endif
$(COMMON_LIB) +
$(PP_LIB) +
$(PCREP_LIB) +
!if $(LNK_ADVANTAGE) == YES
$(RDDADS_LIB) +
$(ACE32_LIB) +
!endif
!if $(LNK_ODBC) == YES
$(ODBC32_LIB) +
!endif
$(CW32_LIB) +
$(IMPORT32_LIB) +
$(LIB_BORL01) +
$(LIB_BORL02) +
$(LIB_BORL03) +
$(LIB_BORL04), +
!if $(RES_FILE) == YES
,$(APP_RES) +
!endif
|
@$(DEL) $(APP_EXE_DIR)\*.tds
@$(DEL) $(APP_EXE_DIR)\*.hrb
@$(DEL) $(APP_EXE_DIR)\*.obj
@$(DEL) $(APP_EXE_DIR)\*.ppo
Es problable que nos falte algún parámetro o flag nuevo en algún lado, pero ya agotamos todas las opciones y quedamos parados. Si no resolvemos esto, ni modo de poder actualizarnos. Estoy seguro que debe haber alguna solución que el Maestro Antonio con su sabiduría nos puede ayudar a encontrar. Ufff me salió en prosa
Maestro Antonio, ayuda please
Saludos,
Carlos Gallego