FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Templates in plugins

 
Post new topic   Reply to topic     Forum Index -> DDL - D Dynamic Libraries
View previous topic :: View next topic  
Author Message
bobef



Joined: 05 Jun 2005
Posts: 269

PostPosted: Wed May 16, 2007 1:00 pm    Post subject: Templates in plugins Reply with quote

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
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Fri May 18, 2007 7:39 am    Post subject: Re: Templates in plugins Reply with quote

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. Smile

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
View user's profile Send private message Yahoo Messenger
bobef



Joined: 05 Jun 2005
Posts: 269

PostPosted: Sat May 19, 2007 2:31 am    Post subject: Reply with quote

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). Smile


Code:
I can provide an example if that helps. Please let me know.


Yes, this will be very helpful, thank you.
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Mon May 21, 2007 12:32 pm    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDL - D Dynamic Libraries All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group