Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
fpc 3.2.2 how to export Functions with same Name and different Arguments ?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
TDirectoryEdit with OnAft...
by
dsiders
[
Today
at 06:14:36 pm]
Variable initialization
by
valdir.marcos
[
Today
at 05:58:47 pm]
Lazarus IDE built for LCL...
by
valdir.marcos
[
Today
at 05:57:09 pm]
X11Libre, finally and for...
by
valdir.marcos
[
Today
at 05:45:57 pm]
Debian removes FPC/Lazaru...
by
valdir.marcos
[
Today
at 04:38:01 pm]
How many lines is too man...
by
valdir.marcos
[
Today
at 04:14:48 pm]
Front-end framework
by
valdir.marcos
[
Today
at 04:10:22 pm]
Status of LCL-fpGUI widge...
by
valdir.marcos
[
Today
at 04:04:53 pm]
Status of LCL's CustomDra...
by
zeljko
[
Today
at 03:59:56 pm]
Benchmark test in nanosec...
by
valdir.marcos
[
Today
at 03:27:08 pm]
Problem wih reference to ...
by
henrique
[
Today
at 02:39:50 pm]
uses unit decalration ord...
by
Martin_fr
[
Today
at 02:10:32 pm]
Update a table with an Au...
by
CraigC
[
Today
at 01:56:50 pm]
could Ardour's YTK be use...
by
robert rozee
[
Today
at 01:51:39 pm]
[SOLVED] File Format LAMW...
by
RaketeMike
[
Today
at 01:41:46 pm]
[ANN] PasBuild 1.5.0 rele...
by
cdbc
[
Today
at 05:10:09 am]
Commerce website written ...
by
valdir.marcos
[
Today
at 04:55:08 am]
New book on Object Pascal
by
valdir.marcos
[
Today
at 04:30:08 am]
How to execute a procedur...
by
Aruna
[
Today
at 03:34:41 am]
BGRAVirtualScreen - weird...
by
backprop
[
Today
at 03:33:51 am]
The "dockedformeditor" pa...
by
Gustavo 'Gus' Carreno
[
Today
at 02:44:31 am]
unit ProjectDescriptorTyp...
by
n7800
[
Today
at 02:01:39 am]
Canvas.StretchDraw, does ...
by
jamie
[March 06, 2026, 11:27:18 pm]
REST Server/Client, how t...
by
kveroneau
[March 06, 2026, 07:35:25 pm]
[SOLVED] Problem to resto...
by
Hartmut
[March 06, 2026, 06:42:28 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: fpc 3.2.2 how to export Functions with same Name and different Arguments ? (Read 584 times)
paule32
Hero Member
Posts: 645
One in all. But, not all in one.
fpc 3.2.2 how to export Functions with same Name and different Arguments ?
«
on:
May 05, 2025, 05:19:44 pm »
Hello,
how can I "export" these three Functions ?
Code: Pascal
[Select]
[+]
[-]
function
CharArrToAnsiStr
(
const
A
:
array
of
AnsiChar
)
:
AnsiString
;
overload
;
stdcall
;
export
;
function
CharArrToAnsiStr
(
const
A
:
array
of
AnsiChar
;
BufLen
:
Integer
)
:
AnsiString
;
overload
;
stdcall
;
export
;
function
CharArrToAnsiStr
(
P
:
PAnsiChar
;
BufLen
:
Integer
)
:
AnsiString
;
overload
;
stdcall
;
export
;
exports
...
?
;
Logged
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.
Fibonacci
Hero Member
Posts: 788
Internal Error Hunter
Re: fpc 3.2.2 how to export Functions with same Name and different Arguments ?
«
Reply #1 on:
May 05, 2025, 05:29:17 pm »
Not possible. Use unique names.
Logged
paule32
Hero Member
Posts: 645
One in all. But, not all in one.
Re: fpc 3.2.2 how to export Functions with same Name and different Arguments ?
«
Reply #2 on:
May 05, 2025, 07:07:46 pm »
Hello @fibonacci
nice to see you.
I have add a discussion on our project for details see the new repro
Logged
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.
marcov
Administrator
Hero Member
Posts: 12706
FPC developer.
Re: fpc 3.2.2 how to export Functions with same Name and different Arguments ?
«
Reply #3 on:
May 05, 2025, 07:38:17 pm »
Linker namespaces usually only support unique symbols. Export the three overload functions "as" three different linker names, then when importing declare them overloaded again.
Logged
paule32
Hero Member
Posts: 645
One in all. But, not all in one.
Re: fpc 3.2.2 how to export Functions with same Name and different Arguments ?
«
Reply #4 on:
May 05, 2025, 07:55:53 pm »
for @all others:
I formed a well working export functionallity:
Code: Pascal
[Select]
[+]
[-]
{$mode delphi}
unit
SysUtils
;
interface
uses
Windows
;
{$ifdef DLLEXPORT}
function
ChATAStr1
(
const
A
:
array
of
AnsiChar
)
:
AnsiString
;
overload
;
stdcall
;
export
;
function
ChATAStr2
(
const
A
:
array
of
AnsiChar
;
BufLen
:
Integer
)
:
AnsiString
;
overload
;
stdcall
;
export
;
function
ChATAStr3
(
P
:
PAnsiChar
;
BufLen
:
Integer
)
:
AnsiString
;
overload
;
stdcall
;
export
;
{$endif DLLEXPORT}
{$ifdef DLLIMPORT}
function
CharArrToAnsiStr
(
const
A
:
array
of
AnsiChar
)
:
AnsiString
;
overload
;
stdcall
;
external
RTLDLL
name
'ChATAStr1'
;
function
CharArrToAnsiStr
(
const
A
:
array
of
AnsiChar
;
BufLen
:
Integer
)
:
AnsiString
;
overload
;
stdcall
;
external
RTLDLL
name
'ChATAStr2'
;
function
CharArrToAnsiStr
(
P
:
PAnsiChar
;
BufLen
:
Integer
)
:
AnsiString
;
overload
;
stdcall
;
external
RTLDLL
name
'ChATAStr3'
;
{$endif DLLIMPORT}
implementation
{$ifdef DLLEXPORT}
function
ChATAStr1
(
const
A
:
array
of
AnsiChar
)
:
AnsiString
;
overload
;
stdcall
;
export
;
begin
...
end
;
function
ChATAStr2
(
const
A
:
array
of
AnsiChar
;
BufLen
:
Integer
)
:
AnsiString
;
overload
;
stdcall
;
export
;
begin
...
end
;
function
ChATAStr3
(
P
:
PAnsiChar
;
BufLen
:
Integer
)
:
AnsiString
;
overload
;
stdcall
;
export
;
begin
...
end
;
{$endif DLLEXPORT}
{$ifdef DLLEXPORT}
exports
ChATAStr1
name
'ChATAStr1'
,
ChATAStr2
name
'ChATAStr2'
,
ChATAStr3
name
'ChATAStr3'
;
{$endif DLLEXPORT}
end
.
Then I built the EXE with a Batch File:
Code: Bash
[Select]
[+]
[-]
fpc
-dDLLEXPORT
-n
-B
-Os
-CD
RTLLib.pas
dlltool
--input-def
rtllib_dll.def
--dllname
rtllib.dll
--output-lib
librtllib_dll.a
fpc
-dDLLIMPORT
-n
-B
-Os
test.pas
strip
test.exe
strip
rtllib.dll
Logged
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.
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
fpc 3.2.2 how to export Functions with same Name and different Arguments ?
TinyPortal
© 2005-2018