Custom calling conventions
Michel Fortin
michel.fortin at michelf.com
Wed Feb 22 04:53:28 PST 2012
On 2012-02-22 07:41:21 +0000, Jacob Carlborg <doob at me.com> said:
> void foo (T) () {}
> void main ()
> {
> foo!(int);
> foo!(char);
> }
>
> $ dmd -inline -O -release main.d
> $ nm main | grep foo
>
> 00000001000012b8 T _D4main10__T3fooTaZ3fooFZv
> 00000001000012b0 T _D4main10__T3fooTiZ3fooFZv
>
> Outputs two symbols as expected, one for each instantiation.
That's expected indeed.
This doesn't mean the inliner will not inline the templates. In fact,
if you correct the example and look at the assembler output you'll see
it will (in your example there is nothing to inline since you're just
instantiating the template without calling it).
What doesn't happen is stripping the unreferenced symbols from the
executable. On OS X, try adding "-L-dead_strip" to DMD's argument to
instruct the linker to do so.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list