View previous topic :: View next topic |
Author |
Message |
bobef
Joined: 05 Jun 2005 Posts: 269
|
Posted: Wed May 16, 2007 1:00 pm Post subject: Templates in plugins |
|
|
One more question. If I use templates inside my plugins. std.boxer to be specific.
The host does not know what the plugins are going to unbox (i.e. what template parameters are going to be used), so the compiler is not generating any code for this template then I get undefined symbols when I try to (dynamic) link the plugin. Is there any way around this?
I hope you understand what I mean. Excuse me for my poor English.
Thanks. |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Fri May 18, 2007 7:39 am Post subject: Re: Templates in plugins |
|
|
bobef wrote: | One more question. If I use templates inside my plugins. std.boxer to be specific.
The host does not know what the plugins are going to unbox (i.e. what template parameters are going to be used), so the compiler is not generating any code for this template then I get undefined symbols when I try to (dynamic) link the plugin. Is there any way around this?
I hope you understand what I mean. Excuse me for my poor English.
Thanks. |
Bobef, your written English is better that that of many native speakers of the language. There is no need to be embarassed. Just take a look at myspace.com sometime.
You're right about template handling in DDL. Any template that you are going to reference needs to be generated by the compiler first.
One question: are you passing your .d files to the compiler individually or as a group? Remember, DMD likes to throw out redundant template symbols if there's more than one .d file on the command line.
I can provide an example if that helps. Please let me know. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
bobef
Joined: 05 Jun 2005 Posts: 269
|
Posted: Sat May 19, 2007 2:31 am Post subject: |
|
|
Quote: | Just take a look at myspace.com sometime. |
Oh I did, but haven't stayed for too long to read anything. I would hardly achieve to make so ugly designs even if I try (I mean the user pages).
Code: | I can provide an example if that helps. Please let me know. |
Yes, this will be very helpful, thank you. |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Mon May 21, 2007 12:32 pm Post subject: |
|
|
Here's the example I was talking about:
Code: |
dmd -c file1.d file2. file3.d
|
This will cut template instances, and type information, out of one or more of the output .obj files after the compiler is done. The decision of what gets removed from where is undefined, but is somewhat order dependent.
IIRC there was a long thread on the DNG between Kirs and Walter about how this behavior was affecting the size of executables compiled against Tango. That was because the library was built using single-line compilation like this, and was causing certain modules to be linked just for type information.
Code: |
dmd -c file1.d
dmd -c file2.d
dmd -c file3.d
|
This is much better. The result is the 100% predictable production of template and type information for file1.obj, file2.obj and file3.obj. This will let DDL find any symbols you need, no matter what. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
|