Thread overview
alias symbols in object files
Apr 21, 2013
John Colvin
Apr 21, 2013
John Colvin
Apr 21, 2013
Andrej Mitrovic
Apr 21, 2013
Peter Alexander
Apr 21, 2013
John Colvin
April 21, 2013
test.d:

extern (C):
void foo(){}
alias foo bar;

$dmd -c test.d

$nm test.o
0000000000000000 t
0000000000000000 D _D11test12__ModuleInfoZ
                 w _d_dso_registry
                 U _Dmodule_ref
0000000000000000 T foo


Surely the aliased symbol should appear in the object file, or am I missing something?
April 21, 2013
On Sunday, 21 April 2013 at 18:54:27 UTC, John Colvin wrote:
> test.d:
>
> extern (C):
> void foo(){}
> alias foo bar;
>
> $dmd -c test.d
>
> $nm test.o
> 0000000000000000 t
> 0000000000000000 D _D11test12__ModuleInfoZ
>                  w _d_dso_registry
>                  U _Dmodule_ref
> 0000000000000000 T foo
>
>
> Surely the aliased symbol should appear in the object file, or am I missing something?

Just to avoid any confusion for non-linux guys:

nm is a linux utility for listing the symbols in an object file.
April 21, 2013
On 4/21/13, John Colvin <john.loughran.colvin@gmail.com> wrote:
> Surely the aliased symbol should appear in the object file, or am I missing something?

Aliases are a purely compile-time feature. Wherever they're used it's as if the compiler rewrote the alias with the aliased symbol.
April 21, 2013
On Sunday, 21 April 2013 at 18:54:27 UTC, John Colvin wrote:
> Surely the aliased symbol should appear in the object file, or am I missing something?

What would you expect it to look like in the object file? A duplicate of the foo function?
April 21, 2013
On Sunday, 21 April 2013 at 19:22:27 UTC, Peter Alexander wrote:
> On Sunday, 21 April 2013 at 18:54:27 UTC, John Colvin wrote:
>> Surely the aliased symbol should appear in the object file, or am I missing something?
>
> What would you expect it to look like in the object file? A duplicate of the foo function?

Something like that, yes.

I have a templated function and need particular instantiations of it in a library. If aliases cannot be used for this, I suppose the most reasonable option is to write wrapper functions.