Zeref
Zeref

Reputation: 43

Calling functions with @

I need to call functions from an external DLL in Delphi, the function have defined the bytes of calling, how should I call them, on declaring them in Delphi, it shows syntax error that it expected ; instead got @

function _imp_Com@32(a1: INT64; a2: Pointer; a3: INT64; a4: Pointer;
 a5: INT64; a6: Pointer; a7: Pointer; a8: INT64): INT64 cdecl stdcall;external 'imp.dll';

function _imp_Decom@56(a1_compbuf: Pointer; a2_clen: INT64;
      a3_out: Pointer; a4_outlen: INT64; a5_crcflag: INT64; a5u: INT64;
      a6_verb: INT64; a7_dict: Pointer; a8_dictsize: INT64; a9_cb: Pointer;
      a10: INT64; a11: Pointer = 0; a12: INT64 = 0; a14: INT64 = 0)
      : INT64 cdecl stdcall;external 'imp.dll';

Upvotes: 2

Views: 128

Answers (1)

David Heffernan
David Heffernan

Reputation: 613442

You can't use that in the name so you need to import the function using a valid identifier. Like this:

function imp_Com(...): Int64; stdcall; external 'imp.dll' name '_imp_Com@32';

A function can't be both cdecl and stdcall. Not sure what that was about in your code. Based on the name decoration, these functions are stdcall.

Upvotes: 6

Related Questions