Fórum Erro de chamada de DLL no FIREBIRD #393289
04/01/2011
0
Creie a seguinte DLL abaixo no delphi.
No delphi fazendo a chamada da DLL funciona normalmente, mas quando declaro
uma UDF no FIRIBIRD dá erro. ***********************************************************************************************
***** Declaração da UDF no FIRBIRD ************************************************************ DECLARE EXTERNAL FUNCTION MYLIMPATEXTO VARCHAR(80)
RETURNS VARCHAR(80) FREE_IT
ENTRY_POINT 'LimpaTexto' MODULE_NAME 'ProjDll'; Copiei a DLL pra a pasta do FIREBIRD EM UDFs.
Quando faço a chamada no FIREBIRD ocorre o seguinte erro: select mylimpatexto(NOMERAZAO) from pessoas Erro:-------------------------------------------------------------------------------------
Unsuccessful execution by a system error that precludes
successful execution of subsequent statements. Error writing data to the connection.
**********************************************************************************************
***** DLL CRIADA NO DELPHI ******************************************************************* library ProjDll;
uses
SysUtils,
Classes; {$R *.res} function LimpaTexto(sTexto: String): String; Export; stdcall;
var
i: Integer;
Texto: String;
begin
sTexto := sTexto + StringOfChar(' ', 20);
Texto := ' ';
for i := 0 to Length(sTexto) do
begin
if not (sTexto[i] in [',', '.', '=', '/', '\', ' ', '_', '-', '+', ':', '?', ';', ')', '(']) then
begin
Texto := Texto + sTexto[i];
end;
end;
Result := Trim(Texto);
end; exports
LimpaTexto index 1; begin
end.
Gilberto Rezende
Curtir tópico
+ 0Posts
05/01/2011
Emerson Nascimento
library ProjDll;
uses
SysUtils,
Classes;
{$R *.res}
function LimpaTexto(sTexto: PChar): PChar; cdecl;
var
i: Integer;
Texto: String;
begin
Texto := ' ';
Result := sTexto;
for i := 0 to Length(sTexto) do
begin
if not (sTexto[i] in [',', '.', '=', '/', '\', ' ', '_', '-', '+', ':', '?', ';', ')', '(']) then
begin
Texto := Texto + sTexto[i];
end;
end;
StrPCopy(sTexto, Trim(Texto));
end;
exports
LimpaTexto;
begin
end.
e, para registrar no Firebird:
DECLARE EXTERNAL FUNCTION MYLIMPATEXTO CSTRING(255)
RETURNS CSTRING(255) FREE_IT
ENTRY_POINT 'LimpaTexto' MODULE_NAME 'ProjDll';
Gostei + 0
06/01/2011
Gilberto Rezende
Unsuccessful execution by a system error that precludes
successful execution of subsequent statements. Error writing data to the connection.
Gostei + 0
06/01/2011
Emerson Nascimento
Gostei + 0
07/01/2011
Gilberto Rezende
Gostei + 0
07/01/2011
Emerson Nascimento
para você poder substituir a DLL é preciso dropar a UDF e fechar o banco de dados. só depois disso a DLL estará disponível para manipuilação e poderá ser substituída.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)