Lazarus

Free Pascal => Windows => Topic started by: 440bx on September 29, 2022, 11:41:08 pm

Title: export entry point aliases
Post by: 440bx 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.
Title: Re: export entry point aliases
Post by: avk 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.  
Title: Re: export entry point aliases
Post by: 440bx 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.
Title: Re: export entry point aliases
Post by: avk on September 30, 2022, 09:17:06 am
You are welcome.
TinyPortal © 2005-2018