Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo Hace 4 Semanas
Nano Ramírez Nano Ramírez is offline
Registrado
 
Registrado: mar 2025
Posts: 9
Poder: 0
Nano Ramírez Va por buen camino
Unhappy Bpl en RAD Studio 10.3 consumido en Delphi 2010

Buen día a todos. Tengo el siguiente bpl creado en RAD Studio 10.3:

Código Delphi [-]
unit unitConsumo; interface uses
System.SysUtils, System.Classes,Vcl.Dialogs, IdHTTP, IdSSLOpenSSLHeaders, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL, IdServerIOHandler, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient;
function pruebaString():string; stdcall; procedure prueba(); implementation procedure prueba(); begin ShowMessage('yes'); end; function pruebaString():string; stdcall; begin Result:='a ver si ya'; end; exports prueba, pruebaString ;



Dicho BPL lo consumo desde delphi 2010:

Código Delphi [-]
program pConsumoBplConsola; {$INCLUDE FastMM4Options.inc} {$APPTYPE CONSOLE} uses FastMM4 in 'FastMM4.pas', FastMM4LockFreeStack in 'FastMM4LockFreeStack.pas', FastMM4Messages in 'FastMM4Messages.pas', SysUtils, Windows; var token: WideString; H: THandle; obtenerToken: function(urlToken, grantType, clienteId, clienteSecreto, resource: string): WideString;stdcall; obtenerString : function(): string; stdcall; obtenerprueba : procedure(); begin ReportMemoryLeaksOnShutdown := true; FullDebugModeScanMemoryPoolBeforeEveryOperation := true; try ScanMemoryPoolForCorruptions; token := 'hola'; H := 0; obtenerToken := nil; obtenerprueba := nil; obtenerString := nil; try H := LoadPackage('ConsumoD365.bpl'); if H <> 0 then begin @obtenerString := GetProcAddress(H, 'pruebaString'); // @obtenerToken:=GetProcAddress(H,'getToken'); // @obtenerprueba:=GetProcAddress(H,'prueba'); if Assigned(obtenerString) then begin token := obtenerString(); { token:=obtenerToken( 'urlToken', 'grant_type', 'clienteId', 'clienteSecreto', 'resource'); } Writeln('*******************************'); Writeln(token); Writeln('*******************************'); end else begin Writeln('No se cargó la función'); end; end else begin Writeln('No se cargó el bpl'); end; except on E: Exception do Writeln('Error dentro;', E.ClassName, ': ', E.Message); end; finally if H <> 0 then begin FreeLibrary(H); end; end; Readln; end.



El problema es el siguiente:
Cuando consumo el BPL y utilizo el procedure funciona sin problema. Pero cuando utilizo una función del BPL me arroja errores de memoria.
El objetivo (como pueden ver en la variable comentada "{token:=obtenerToken(...}") es consumir una api que me retorne un token de acceso y sí lo hace correctamente pero el problema es el mismo, aparecen errores de memoria.
Pensé que sería un problema por los dcp que utiliza mi BPL para hacer la conexión, por lo que hice este ejemplo en donde la función retorne solamente un valor String y también lo regresa de forma correcta, pero persiste el problema de fuga de memoria.

He utilizado la herramienta FastMM4 y me arroja este reporte:


--------------------------------2025/3/27 18:06:48--------------------------------
FastMM has detected an error during a FreeMem operation. The block header has been corrupted.

The current thread ID is 0x358C, and the stack trace (return addresses) leading to this error is:
00403C56 [System.pas][System][FreeMem][3030]
00405D26 [System.pas][System][LStrArrayClr][13726]
00416394
77B1FCC9 [BaseThreadInitThunk]
77E67CBE [RtlGetAppContainerNamedObjectPath]
77E67C8E [RtlGetAppContainerNamedObjectPath]

Current memory dump of 256 bytes starting at pointer address 2AA8508:
B0 04 02 00 00 00 00 00 0B 00 00 00 61 00 20 00 76 00 65 00 72 00 20 00 73 00 69 00 20 00 79 00
61 00 00 00 01 00 00 00 B0 04 02 00 00 00 00 00 0B 00 00 00 74 00 70 00 65 00 72 00 73 00 69 00
73 00 74 00 65 00 6E 00 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
° . . . . . . . . . . . a . . v . e . r . . s . i . . y .
a . . . . . . . ° . . . . . . . . . . . t . p . e . r . s . i .
s . t . e . n . t . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Estos son los dcp usados por mi BPL:

bindcomp.dcp
bienengine.dcp
IndyCore.dcp
IndyProtocols.dcp
IndySystem.dcp
rtl.dcp
vcl.dcp
Agradezco de antemano la atención y ojalá alguien pueda apoyarme.
PD: soy nuevo el Delphi
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
ZeosDBO 6.6.6 stable en RAD Studio 2010 Kaiken Conexión con bases de datos 2 18-08-2012 00:40:31
Webservices en Vb.net consumido por Delphi XE nasedo Varios 1 04-08-2011 19:29:37
descargar visual studio 2010 agustin173 .NET 2 17-01-2011 18:52:52
Visual Studio 2010 MAXIUM La Taberna 8 16-11-2010 13:47:32
Delphi development offered for Microsoft Visual Studio 2010 JXJ Noticias 0 22-04-2010 20:36:17


La franja horaria es GMT +2. Ahora son las 18:56:10.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi