Why export external(C) generate mangled names?
Simen Kjærås
simen.kjaras at gmail.com
Fri Oct 25 11:16:49 UTC 2019
On Friday, 25 October 2019 at 10:31:15 UTC, Suliman wrote:
> I thought that export extern(C) is needed for C compatibility.
> But When I am compiling follow code
>
> export extern(C)
> {
> void foo()
> {
> }
> }
>
> I am getting section that have mangled names:
>
> � foo.d � �7nO � �CV �,
> FLAT_TEXTCODE_DATADATACONST_BSSBSS � � � i
> � i
� i � � _foo �
> �
� _foo �
FMBFMFME � �
� �
� �
> � __D3foo12__ModuleInfoZ �
>
> � � foo �
> � � �
>
> Why is __D3foo12__ModuleInfoZ added to obj file?
Is your module (source file) called foo? Because that name is for
the ModuleInfo of a module by that name, and has nothing to do
with the function called the same.
Like Daniel said, -betterc inhibits the creation of moduleinfo,
so if that's what you're after, you should use it.
--
Simen
More information about the Digitalmars-d
mailing list