Recent

Author Topic: FPC 3.2.2 - how to export a Variable under different name ?  (Read 654 times)

paule32

  • Hero Member
  • *****
  • Posts: 647
  • One in all. But, not all in one.
Hello,
I would like to "export" a Variable to/from a DLL File.
I have the following Code:

Code: Pascal  [Select][+][-]
  1. var
  2.   sError_TButton_isinit: AnsiString = 'TButton: bereits init.';  [public, alias: 'mErr8001']; export;

But I get Error Message:

Code: Bash  [Select][+][-]
  1. module.pas(106,52) Fatal: Syntax error, "IMPLEMENTATION" expected but "[" found

So, the Question Request is: how can I "export" a Variable under different name by not changing the original form ?
MS-IIS - Internet Information Server, Apache, PHP/HTML/CSS, MinGW-32/64 MSys2 GNU C/C++ 13 (-stdc++20), FPC 3.2.2
A Friend in need, is a Friend indeed.

ASerge

  • Hero Member
  • *****
  • Posts: 2510
Re: FPC 3.2.2 - how to export a Variable under different name ?
« Reply #1 on: June 27, 2025, 05:21:57 am »
Code: Pascal  [Select][+][-]
  1. var
  2.   sError_TButton_isinit: AnsiString = 'TButton: bereits init.'; export name 'mErr8001';

paule32

  • Hero Member
  • *****
  • Posts: 647
  • One in all. But, not all in one.
Re: FPC 3.2.2 - how to export a Variable under different name ?
« Reply #2 on: June 27, 2025, 10:16:35 am »
Thank you.

And how about Function's/Procedure's ?

Now, I have:

Code: Pascal  [Select][+][-]
  1. function utf16__toutf8(utf16: pwidechar): RawByteString; stdcall; export name 'utf16__toutf8_pwc';

but I get in touch with Error:

Code: Bash  [Select][+][-]
  1. unicode.inc(279,74) Fatal: Syntax error, ";" expected but "identifier NAME" found
  2. Fatal: Compilation aborted

The Problem of my Request is the "overload"ing of Members (Function's/Procedure's) with same Name but different Argument(s).
MS-IIS - Internet Information Server, Apache, PHP/HTML/CSS, MinGW-32/64 MSys2 GNU C/C++ 13 (-stdc++20), FPC 3.2.2
A Friend in need, is a Friend indeed.

ASerge

  • Hero Member
  • *****
  • Posts: 2510
Re: FPC 3.2.2 - how to export a Variable under different name ?
« Reply #3 on: June 27, 2025, 12:11:11 pm »
but I get in touch with Error:
Code: Pascal  [Select][+][-]
  1. function utf16__toutf8(utf16: pwidechar): RawByteString; stdcall;
  2. begin
  3.   //...
  4. end;
  5.  
  6. exports utf16__toutf8 name 'utf16__toutf8_pwc';
  7.  

Quote
The Problem of my Request is the "overload"ing of Members (Function's/Procedure's) with same Name but different Argument(s).
You cannot export different procedures with the same name.

 

TinyPortal © 2005-2018