Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
April 21, 2013 alias symbols in object files | ||||
---|---|---|---|---|
| ||||
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 Re: alias symbols in object files | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Colvin | 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 Re: alias symbols in object files | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Colvin | 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 Re: alias symbols in object files | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Colvin | 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 Re: alias symbols in object files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Peter Alexander | 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.
|
Copyright © 1999-2021 by the D Language Foundation