Export overloaded functions using fpc

I need to create a dll inside fpc (delphi-mode). It works fine - but for some reason I want to do something (in a block) like

function doSomeThing(a:type1):type2;stdcall;
function doSomeThing(a:type3):type4;stdcall;

and in the library (to build the dll library using the device above)

exports
    doSomeThing(a:type1) name 'doSomeThingTYPE1',
    doSomeThing(a:type3) name 'doSomeThingTYPE3';

The syntax is self-evident and is listed in How to export overload functions from a DLL? . But it seems to be unavailable in fpc (version 2.6.0-9 [2013/04/14] for x86_64). Is there any way to do something like this - or do I need to rename functions in my source?

0
source share
2 answers

David consulted with me in another thread, I came up with something that compiles, but I don’t know if it works.

, , Pascal. , bla bla2 , dosomething.

library testdll; 

{$mode delphi}
type 
   type1=integer;
   type3=char;
   type2=smallint;
   type4=widechar;

function doSomeThing(a:type1):type2;stdcall; overload; [public, alias:'bla'];
begin
  result:=a+1;
end;

function doSomeThing(a:type3):type4;stdcall; overload; [public, alias:'bla2'];
begin
  result:=widechar(ord(a)+1000);
end;

procedure bla; external name 'bla';
procedure bla2; external name 'bla2';
exports
    bla name 'doSomeThingTYPE1',
    bla2 name 'doSomeThingTYPE3';

end.
+1

, , Delphi. , Delphi, , FPC.

, . , . , , .

+2

All Articles