not working udf
---------------

                 Key: CORE-5945
                 URL: http://tracker.firebirdsql.org/browse/CORE-5945
             Project: Firebird Core
          Issue Type: Bug
    Affects Versions: 3.0.4
         Environment: Firebird 3.0.4 Win7 x64
            Reporter: andrey


not working udf

error message:
Invalid token.
invalid request BLR at offset 39.
function GEN_UUID_SEQUENTIAL is not defined.
module name or entrypoint could not be found.


source code:
library uuid;

{declare external function gen_uuid_sequential
returns char(16) character set octets free_it 
entry_point 'gen_uuid_sequential' module_name 'uuid.dll'}

function UuidCreateSequential(var guid: TGUID): HResult; stdcall; external 
'RPCRT4.dll';
function ib_util_malloc(l: integer): pointer; cdecl; external 'ib_util.dll';

function gen_uuid_sequential: PAnsiChar; cdecl; export;
var
  uid: TGUID;
begin
  Result := ib_util_malloc(16);
  UuidCreateSequential(uid);
  Move(uid, Result^, SizeOf(uid));
end;

exports
  gen_uuid_sequential;

begin
  isMultiThread := True;
end.

checking project code:

procedure TForm1.Button1Click(Sender: TObject);
type
 PGuid= ^TGuid;
var
 gen_uuid_sequential: function(): PAnsiChar;
 LibHandle: THandle;
 FileName: string;
 Error: DWORD;
 g: PGuid;
begin
  FileName:= ExtractFilePath(Application.ExeName) + 'uuid.dll';
  @gen_uuid_sequential := nil;
  LibHandle := SafeLoadLibrary(FileName);
  if LibHandle >= 32 then
  begin
    @gen_uuid_sequential := GetProcAddress(LibHandle, 'gen_uuid_sequential');
    if @gen_uuid_sequential <> nil then
    begin
      g := PGuid(gen_uuid_sequential());
      ShowMessage(GuidToString(g^));
    end;
  end
  else
  begin
    Error:= GetLastError();
    ShowMessage('Error: ' + IntToStr(Error));
  end;
  FreeLibrary(LibHandle);
end;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to