Error al leer un dll

Error al leer un dll

Postby jpcavagnaro » Thu Apr 20, 2023 2:28 pm

Hola gente, en fwh2212 estoy intentando hacer :

xDll := LoadLibrary( "WINFIS32.DLL" )

y me devuelve "0x0" si no existe y "0x000000" si es correco, como pregunto por estos valores porque son tipo P (puntero según leí)

Saludos
Jorge
Jorge
Saludos.
jpcavagnaro
 
Posts: 155
Joined: Tue Oct 11, 2016 1:02 pm
Location: Luján, bs. as.

Re: Error al leer un dll

Postby karinha » Thu Apr 20, 2023 5:35 pm

jpcavagnaro wrote:Hola gente, en fwh2212 estoy intentando hacer :

xDll := LoadLibrary( "WINFIS32.DLL" )

y me devuelve "0x0" si no existe y "0x000000" si es correco, como pregunto por estos valores porque son tipo P (puntero según leí)

Saludos
Jorge


Mira esto, pls:

https://forums.fivetechsupport.com/~fivetec1/forums/viewtopic.php?f=6&t=34894&sid=a2dc13995ee3ff487b03bb31ffd56fba

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Error al leer un dll

Postby jpcavagnaro » Fri Apr 21, 2023 7:04 pm

Hola, si, me copie el programa para probar y al igual que el mio, en fw1709 funciona perfecto, pero en fw2212 no, ni el ejemplo ni em mío.

Saludos
Jorge
Jorge
Saludos.
jpcavagnaro
 
Posts: 155
Joined: Tue Oct 11, 2016 1:02 pm
Location: Luján, bs. as.

Re: Error al leer un dll

Postby Antonio Linares » Sat Apr 22, 2023 10:11 am

Estimado Jorge,

Si estas usando estás funciones:
DLL32 FUNCTION OpenComFiscal( nCom AS _INT, nMode AS _INT ) AS _INT PASCAL FROM "OpenComFiscal" LIB "winfis32.dll"
DLL32 FUNCTION MandaPaqueteFiscal( nHandler AS _INT, cBuffer AS LPSTR ) AS _INT PASCAL FROM "MandaPaqueteFiscal" LIB "winfis32.dll"
DLL32 FUNCTION UltimaRespuesta( nHandler AS _INT, cBuffer AS LPSTR ) AS _INT PASCAL FROM "UltimaRespuesta" LIB "winfis32.dll"
DLL32 FUNCTION CloseComFiscal( nHandler AS _INT ) AS VOID PASCAL FROM "CloseComFiscal" LIB "winfis32.dll"
DLL32 FUNCTION ReOpenComFiscal( nCom AS _INT ) AS _INT PASCAL FROM "ReOpenComFiscal" LIB "winfis32.dll"
DLL32 FUNCTION InitFiscal( nHandler AS _INT ) AS _INT PASCAL FROM "InitFiscal" LIB "winfis32.dll"
DLL32 FUNCTION VersionDLLFiscal( ) AS _INT PASCAL FROM "VersionDLLFiscal" LIB "winfis32.dll"
DLL32 FUNCTION BusyWaitingMode( nMode AS _INT ) AS VOID PASCAL FROM "BusyWaitingMode" LIB "winfis32.dll"
DLL32 FUNCTION CambiarVelocidad( nPortNumber AS _INT, nNewSpeed AS LONG) AS VOID PASCAL FROM "CambiarVelocidad" LIB "winfis32.dll"
DLL32 FUNCTION SearchPrn( nHandler AS _INT ) AS LONG PASCAL FROM "SearchPrn" LIB "winfis32.dll"
DLL32 FUNCTION ProtocolMode( nMode AS _INT ) AS _INT PASCAL FROM "ProtocolMode" LIB "winfis32.dll"
DLL32 FUNCTION SetCommandRetries( nRetries AS _INT ) AS _INT PASCAL FROM "SetCommandRetries" LIB "winfis32.dll"
DLL32 FUNCTION Abort( nPortNumber AS _INT ) AS VOID PASCAL FROM "Abort" LIB "winfis32.dll"

deberias cambiarlas para que en vez de usar ... LIB "winfis32.dll" usen ... LIB hDll

declara static hDll al comienzo del PRG donde las tengas

y en tu código haz:
hDll := LoadLibrary( "winfis32.dll" )

y cuando termines de usarlas:
FreeLibrary( hDll )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error al leer un dll

Postby jpcavagnaro » Sat Apr 22, 2023 11:35 am

Hola Antonio, el error lo tengo en el loadllibrary, lo que devuelve:

hDll := LoadLibrary( "winfis32.dll" )

el hDll = 0x0000000 si la librería existe o 0x0 si no existe, en lugar de devolver 0 si es correcto o el -1

Saludos
Jorge
Jorge
Saludos.
jpcavagnaro
 
Posts: 155
Joined: Tue Oct 11, 2016 1:02 pm
Location: Luján, bs. as.

Re: Error al leer un dll

Postby karinha » Sat Apr 22, 2023 12:19 pm

Post tú código, pls.

Gracias.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Error al leer un dll

Postby Antonio Linares » Sat Apr 22, 2023 1:49 pm

jpcavagnaro wrote:Hola Antonio, el error lo tengo en el loadllibrary, lo que devuelve:

hDll := LoadLibrary( "winfis32.dll" )

el hDll = 0x0000000 si la librería existe o 0x0 si no existe, en lugar de devolver 0 si es correcto o el -1

Saludos
Jorge


Si hDLL vale cero (da igual que esté escrito en hexadecimal) significa que no hay podido cargar la DLL.

Si me envias la DLL te digo que otras DLls necesita...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error al leer un dll

Postby jpcavagnaro » Sat Apr 22, 2023 2:59 pm

Antonio, gracias por responder

Te paso el link
https://drive.google.com/file/d/1XE1JBO ... sp=sharing

Saludos
Jorge
Jorge
Saludos.
jpcavagnaro
 
Posts: 155
Joined: Tue Oct 11, 2016 1:02 pm
Location: Luján, bs. as.

Re: Error al leer un dll

Postby karinha » Sat Apr 22, 2023 4:24 pm

https://imgur.com/qwWxUYt

Image

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Error al leer un dll

Postby karinha » Sat Apr 22, 2023 4:28 pm

Código:

Code: Select all  Expand view  RUN

// C:\FWH..\SAMPLES\WINFIS32.PRG - Compilado con Harbour y xHarbour.

#Include "FiveWin.Ch"
#Include "Directry.ch"
#include "dll.ch"

STATIC XDLL

FUNCTION Main()

   // debe estar en el carpeta del programa
   xDll := LoadLibrary( "WINFIS32.DLL" )

   IF xDll > 0

      ? "Open DLL funciona"

   ELSE

      ? "Open DLL no funciona"

   ENDIF

   // Continua...

   // ACTIVATE...

   // FreeLibrary( xDll )

RETURN NIL

DLL32 FUNCTION OpenComFiscal( nCom AS _INT, nMode AS _INT ) AS _INT PASCAL FROM "OpenComFiscal" LIB XDLL
DLL32 FUNCTION MandaPaqueteFiscal( nHandler AS _INT, cBuffer AS LPSTR ) AS _INT PASCAL FROM "MandaPaqueteFiscal" LIB XDLL
DLL32 FUNCTION UltimaRespuesta( nHandler AS _INT, cBuffer AS LPSTR ) AS _INT PASCAL FROM "UltimaRespuesta" LIB XDLL
DLL32 FUNCTION CloseComFiscal( nHandler AS _INT ) AS VOID PASCAL FROM "CloseComFiscal" LIB XDLL
DLL32 FUNCTION ReOpenComFiscal( nCom AS _INT ) AS _INT PASCAL FROM "ReOpenComFiscal" LIB XDLL
DLL32 FUNCTION InitFiscal( nHandler AS _INT ) AS _INT PASCAL FROM "InitFiscal" LIB XDLL
DLL32 FUNCTION VersionDLLFiscal( ) AS _INT PASCAL FROM "VersionDLLFiscal" LIB XDLL
DLL32 FUNCTION BusyWaitingMode( nMode AS _INT ) AS VOID PASCAL FROM "BusyWaitingMode" LIB XDLL
DLL32 FUNCTION CambiarVelocidad( nPortNumber AS _INT, nNewSpeed AS LONG) AS VOID PASCAL FROM "CambiarVelocidad" LIB XDLL
DLL32 FUNCTION SearchPrn( nHandler AS _INT ) AS LONG PASCAL FROM "SearchPrn" LIB XDLL
DLL32 FUNCTION ProtocolMode( nMode AS _INT ) AS _INT PASCAL FROM "ProtocolMode" LIB XDLL
DLL32 FUNCTION SetCommandRetries( nRetries AS _INT ) AS _INT PASCAL FROM "SetCommandRetries" LIB XDLL
DLL32 FUNCTION Abort( nPortNumber AS _INT ) AS VOID PASCAL FROM "Abort" LIB XDLL

// FIN / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Error al leer un dll

Postby karinha » Sat Apr 22, 2023 4:31 pm

Mira:

Code: Select all  Expand view  RUN

Carpeta de c:\FWH1905\samples

22/04/2023  13:27            13.691 WINFIS32.c
22/04/2023  13:17            73.728 winfis32.dll
22/04/2023  13:27         4.003.840 WINFIS32.exe
22/04/2023  13:27           777.945 WINFIS32.map
22/04/2023  13:27             6.273 WINFIS32.obj
22/04/2023  13:27            11.333 WINFIS32.ppo
22/04/2023  13:28             1.762 WINFIS32.PRG
22/04/2023  13:27           524.288 WINFIS32.tds
 


Regards, saludos
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Error al leer un dll

Postby jpcavagnaro » Sun Apr 23, 2023 9:58 am

Hola Karinha, como comente antes en la versión 1709 funciona, en la 2212 no, les copio el bat que uso para compilar, quiza me falte alguna librería

@ECHO OFF
CLS
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FiveWin for xHarbour 22.12 - Dec. 2022 Harbour development power ³Ü
ECHO ³ (c) FiveTech 1993-2022 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST

ECHO Compiling...

if "%FWDIR%" == "" set FWDIR=c:\fwh2212
if "%XHDIR%" == "" set XHDIR=c:\xharbour74
rem if "%2" == "/b" set GT=gtwin
rem if not "%2" == "/b" set GT=gtgui
set GT=gtgui

set hdir=%XHDIR%
set hdirl=%hdir%\lib
set bcdir=c:\bcc7
set fwh=%FWDIR%

%hdir%\bin\harbour %1 /n /i%fwh%\include;%hdir%\include /w /p %2 %3 > comp.log 2> warnings.log
IF ERRORLEVEL 1 GOTO COMPILEERRORS
@type comp.log
@type warnings.log

echo -O2 -e%1.exe -I%hdir%\include -I%bcdir%\include %1.c > b32.bc
%bcdir%\bin\bcc32 -M -c -v @b32.bc
:ENDCOMPILE

IF EXIST %1.rc %bcdir%\bin\brc32.exe -r -I%bcdir%\include -I%bcdir%\include\windows\sdk %1

echo %bcdir%\lib\c0w32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.exe, + >> b32.bc
echo %1.map, + >> b32.bc
echo %fwh%\lib\Fivehx.lib %fwh%\lib\FiveHC.lib %fwh%\lib\libmysql.lib + >> b32.bc
echo %fwh%\lib\pgsql.lib %fwh%\lib\libpq.lib + >> b32.bc
echo %hdirl%\hbhpdf.lib + >> b32.bc
echo %hdirl%\libharu.lib + >> b32.bc
echo %hdirl%\png.lib + >> b32.bc
echo %hdirl%\rtl.lib + >> b32.bc
echo %hdirl%\vm.lib + >> b32.bc
echo %hdirl%\%GT%.lib + >> b32.bc
echo %hdirl%\lang.lib + >> b32.bc
echo %hdirl%\macro.lib + >> b32.bc
echo %hdirl%\rdd.lib + >> b32.bc
echo %hdirl%\dbfntx.lib + >> b32.bc
echo %hdirl%\dbfcdx.lib + >> b32.bc
echo %hdirl%\dbffpt.lib + >> b32.bc
echo %hdirl%\hbsix.lib + >> b32.bc
echo %hdirl%\debug.lib + >> b32.bc
echo %hdirl%\common.lib + >> b32.bc
echo %hdirl%\codepage.lib + >> b32.bc
echo %hdirl%\pp.lib + >> b32.bc
echo %hdirl%\pcrepos.lib + >> b32.bc
echo %hdirl%\ct.lib + >> b32.bc
echo %hdirl%\zlib.lib + >> b32.bc
echo %hdirl%\hbzip.lib + >> b32.bc
echo %hdirl%\libmisc.lib + >> b32.bc
echo %hdirl%\tip.lib + >> b32.bc
echo %hdirl%\hbzebra.lib + >> b32.bc
rem echo %hdirl%\png.lib + >> b32.bc

rem Uncomment these two lines to use Advantage RDD
rem echo %hdir%\lib\rddads.lib + >> b32.bc
rem echo %hdir%\lib\Ace32.lib + >> b32.bc

echo %bcdir%\lib\cw32.lib + >> b32.bc
echo %bcdir%\lib\import32.lib + >> b32.bc
echo %bcdir%\lib\uuid.lib + >> b32.bc
echo %bcdir%\lib\ws2_32.lib + >> b32.bc
echo %bcdir%\lib\psdk\odbc32.lib + >> b32.bc
echo %bcdir%\lib\psdk\rasapi32.lib + >> b32.bc
echo %bcdir%\lib\psdk\nddeapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\msimg32.lib + >> b32.bc
echo %bcdir%\lib\psdk\psapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\gdiplus.lib + >> b32.bc
echo %bcdir%\lib\psdk\iphlpapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\shell32.lib, >> b32.bc

IF EXIST %1.res echo %1.res >> b32.bc

rem uncomment this line to use the debugger and comment the following one
if %GT% == gtwin %bcdir%\bin\ilink32 -Gn -Tpe -s -v @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
if %GT% == gtgui %bcdir%\bin\ilink32 -Gn -aa -Tpe -s -v @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * Application successfully built *
%1
GOTO EXIT
ECHO

rem delete temporary files
@del %1.c

:COMPILEERRORS
@type comp.log
ECHO * Compile errors *
pause
GOTO EXIT

:LINKERROR
ECHO * Linking errors *
pause
GOTO EXIT

:SINTAX
ECHO SYNTAX: Build [Program] {-- No especifiques la extensi?n PRG
ECHO {-- Don't specify .PRG extension
GOTO EXIT

:NOEXIST
ECHO The specified PRG %1 does not exist

:EXIT


Saludos
Jorge
Jorge
Saludos.
jpcavagnaro
 
Posts: 155
Joined: Tue Oct 11, 2016 1:02 pm
Location: Luján, bs. as.

Re: Error al leer un dll

Postby Antonio Linares » Sun Apr 23, 2023 10:03 am

Estimado Jorge,

> como comente antes en la versión 1709 funciona, en la 2212 no

Que error te da ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error al leer un dll

Postby karinha » Sun Apr 23, 2023 12:12 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Error al leer un dll

Postby jpcavagnaro » Mon Apr 24, 2023 11:44 am

jpcavagnaro wrote:Hola Antonio, el error lo tengo en el loadllibrary, lo que devuelve:

hDll := LoadLibrary( "winfis32.dll" )

el hDll = 0x0000000 si la librería existe o 0x0 si no existe, en lugar de devolver 0 si es correcto o el -1

Saludos
Jorge
Jorge
Saludos.
jpcavagnaro
 
Posts: 155
Joined: Tue Oct 11, 2016 1:02 pm
Location: Luján, bs. as.

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 26 guests