PDA

Ver la Versión Completa : problema al cargar libreria dll


JULIPO
08-11-2015, 13:50:22
Reciban un cordial saludo.

estoy integrando una libreria dll para la conexion de lectoras biometricas pero no me funciona realmente nada.

la informacion del fabricante indica

4.1 Connect
[Function] int Connect(const char *Parameters)
[Objective]
The function is used to connect a device. After the connection is successful, the connection handle is returned.
[Parameter description]
[in]: Specify the connection options through the parameter, for example:
"protocol=RS485,port=COM2,baudrate=38400bps,deviceid=1,timeout=50000, passwd=”;
“protocol=TCP,ipaddress=192.168.12.154,port=4370,timeout=4000,passwd=”;
To connect a device, the system needs to transfer the device-related connection parameters.
protocol indicates the protocol used for communication. At present, RS485 and TCP can be used.
port: Communication port of the device. For example, if the RS485 protocol is used, you can set port to
COM1: If the TCP is used, the default port is 4370 unless otherwise noted.
deviceid: Device ID used by the serial port.
baudrate: Baud rate used for the communication of the communication of the serial port.
ipaddress: IP address of the related device for TCP/IP communication.
timeout: Timeout time of the connection (unit: ms)If the network connection is in poor condition, you
should set the parameter to a larger value. Usually, timeout=5000 (5 seconds) can meet the basic network
needs. When the query result contains the error code of -2, you should set timeout to a larger value, for
example, timeout=20000 (20 seconds).
passwd: Connection password of the communication. If the parameter value is null, it indicates that no
password is used.
(Note: The connection parameters are case-sensitive)
[Returned value]
If the device is connected successfully, the connection handle is returned. Otherwise, the error code of 0 is
returned.
[Example]
Python:
params = “protocol=TCP,ipaddress=192.168.12.154,port=4370,timeout=4000,passwd=”
self.commpro = windll.LoadLibrary("plcommpro.dll")
constr = create_string_buffer(params)
self.hcommpro = self.commpro.Connect(constr)
c#:
params = “protocol=TCP,ipaddress=192.168.12.154,port=4370,timeout=2000,passwd=” ;
IntPtr h = Connect(params);


en delphi hice la siguiente codificacion para enlazar la libreria pero me genera errores

Function connect (Parameters : pansichar):integer; stdcall external 'plcommpro.dll';
procedure TForm1.Button1Click(Sender: TObject);
var
parametros:ansistring;
param1:pansichar;
begin
parametros:='protocol=TCP,ipaddress=192.168.12.154,port=4370,timeout=4000,passwd=';
GetMem(param1, Length(parametros)+1);
StrPCopy(param1, parametros);
if connect(param1)=1 then
begin
ShowMessage('Coneactada');
end
else
begin
ShowMessage('Desconeactada');
end;
end;


pero me genera el siguiente error cuando compilo en 64

---------------------------
Debugger Fault Notification
---------------------------
Project C:\Users\juliodyn\Documents\Embarcadero\Studio\Projects\lectoras pull\Win64\Debug\Project1.exe faulted with message: ' c0000139 ENTRYPOINT_NOT_FOUND'. Process Stopped. Use Step or Run to continue.
---------------------------
OK
---------------------------


y el siguiente error cuando compilo en 32 por ver que pasaba

---------------------------
Debugger Fault Notification
---------------------------
Project C:\Users\juliodyn\Documents\Embarcadero\Studio\Projects\lectoras pull\Win32\Debug\Project1.exe faulted with message: 'system exception (code 0xc0000409) at 0x77099610'. Process Stopped. Use Step or Run to continue.
---------------------------
OK
---------------------------



Que es lo que estoy haciendo mal?

de antemano gracias por la ayuda que me puedan brindar

JULIPO
08-11-2015, 15:19:19
Resulta que en la documentacion la rutina se llama Connect y yo escribi connect al tener diferencia en la Primera letra entre mayuscula y minuscula no funciona, solucionado

dec
08-11-2015, 19:20:11
Hola,

Gracias por aclarar dónde estaba el problema. ^\||/

AngelEG
08-01-2019, 15:00:58
Buen día JULIPO, y a todos los del Club, les comento que estamos intentando hacer interfaz con la misma .dll entiendo de la Serie C3 de ZKTECO, he podido conectarme a la misma con tu método, al igual que utilizando la otra dll. zkemkeeper proporcionada por el fabricante, pero con ninguna logro obtener info, ya sea registros de log o en tiempo real, lograste hacerlo, podrias orientarme un poco.
Gracias