Recent

Author Topic: export entry point aliases  (Read 438 times)

440bx

  • Hero Member
  • *****
  • Posts: 3164
export entry point aliases
« on: September 29, 2022, 11:41:08 pm »
Hello,

It is somewhat common to see Windows DLLs that have multiple exported functions lead to the same piece of code, IOW, they all share the same entry point.

I was wondering if it is possible to do that with FPC.  IOW, is it possible to assign multiple exported function names to an FPC written function or procedure ? if the answer is yes, then I'd like to know how it is done.

Thank you for your help.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 SP1 64bit.

avk

  • Hero Member
  • *****
  • Posts: 652
    • my self-education project
Re: export entry point aliases
« Reply #1 on: September 30, 2022, 05:32:55 am »
Maybe something like this?
Code: Pascal  [Select][+][-]
  1. library test;
  2.  
  3. {$mode objfpc}
  4.  
  5. function MyFun(c: Integer): Integer;
  6. begin
  7.   Result := c * 10;
  8. end;
  9.  
  10. exports
  11.    MyFun,
  12.    MyFun name 'MySameFun',
  13.    MyFun name 'MyOtherSameFun';
  14. begin
  15. end.
  16.  

440bx

  • Hero Member
  • *****
  • Posts: 3164
Re: export entry point aliases
« Reply #2 on: September 30, 2022, 06:32:20 am »
Maybe something like this?
Yes!  That's exactly what I was wondering how to do.  Great example too!

Thank you very much @avk, much appreciated.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 SP1 64bit.

avk

  • Hero Member
  • *****
  • Posts: 652
    • my self-education project
Re: export entry point aliases
« Reply #3 on: September 30, 2022, 09:17:06 am »
You are welcome.

 

TinyPortal © 2005-2018