[firebase-br] [Meio Off] Problemas com UDF

Sérgio Alexandre Gianezini sergio_ag em terra.com.br
Sáb Out 17 17:53:44 -03 2009


function Teste: String;
begin
   Result := 'Teste';
end;
end.

Milagre não ter derrubado o servidor, "String" é um tipo controlado pelo 
delphi, e não é compativel com outros compiladores...

tente isso:

Program funcoesIB;

Function FBAlloc(Size: Integer): Pointer; Cdecl; External 'ib_util.dll' Name 
'ib_util_malloc';
Function ReturnString(Const Buffer: String): PChar;
Begin
  Result := StrPCopy(FBAlloc(Length(Buffer) + 1), Buffer);
End;

Function Teste(Dummy: PInteger): PChar; Cdecl; Export;
Begin
    Result := ReturnString('TESTE');
End;

Exports
    Teste;

--- Dentro do banco, criação da chamada
DECLARE EXTERNAL FUNCTION getTeste
INTEGER
RETURNS CSTRING(10) FREE_IT
ENTRY_POINT 'Teste' MODULE_NAME 'funcoesIB'

--- Chamada na SQL
select getTeste(0) from rdb$database







Mais detalhes sobre a lista de discussão lista