niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » C++
Force linker to check all the implementation
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
Alan Johnson
*nix forums Guru Wannabe


Joined: 14 May 2005
Posts: 206

PostPosted: Thu Jul 20, 2006 7:13 am    Post subject: Re: Force linker to check all the implementation Reply with quote

toton wrote:
Quote:
In C++ , when the class is declared in the header & not implemented in
the cpp, the linker is not giving a error untill the method gets
called. How to ensure that all non pure-virtual method declared is
implemented, even when the method/member function not getting called.
Any linker checking can be performed for this purpose?


As far as I know, the language doesn't give you any mechanism for that
purpose. You might could try something like forming pointers to all
your functions (or just calling them all). Beyond that it is going to
be an implementation specific issue.

Quote:
How can a template class can be splitted in header & source? And to
ensure every method is having an implementation at the compile time?
Also, can a template class be made a shared object (dll) & header
combination, so that it can be linked with a different program, without
recompiling the template class source code (or shipping the template
class source code) ?


This is in the FAQ:
http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12

Quote:
I am using boost for some computation. As it is a huge library, with
most of the classes are template, It causes a large compile time for
the program. can it be build as shared library (static / dynamic) and
linked in my program? ...
I am using gcc 4.0.2 version at present...

Much of Boost can (and is) compiled to libraries. The templates,
however, cannot, because that doesn't make any sense. As much as you
might like them to be, a class template and a class are not the same
thing. Think of templates as code generators. You give them some
parameters, and they generate some code for you. Before those
parameters are known, there is no code to compile.

--
Alan Johnson
Back to top
toton
*nix forums beginner


Joined: 24 Apr 2006
Posts: 3

PostPosted: Thu Jul 20, 2006 6:08 am    Post subject: Force linker to check all the implementation Reply with quote

In C++ , when the class is declared in the header & not implemented in
the cpp, the linker is not giving a error untill the method gets
called. How to ensure that all non pure-virtual method declared is
implemented, even when the method/member function not getting called.
Any linker checking can be performed for this purpose?

How can a template class can be splitted in header & source? And to
ensure every method is having an implementation at the compile time?
Also, can a template class be made a shared object (dll) & header
combination, so that it can be linked with a different program, without
recompiling the template class source code (or shipping the template
class source code) ?

I am using boost for some computation. As it is a huge library, with
most of the classes are template, It causes a large compile time for
the program. can it be build as shared library (static / dynamic) and
linked in my program? ...
I am using gcc 4.0.2 version at present...



abir
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Wed Dec 03, 2008 8:42 pm | All times are GMT
navigation Forum index » Programming » C++
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts I need to configure DHCP server to force client to obtain... malazc@gmail.com networking 1 Thu Jul 20, 2006 8:44 pm
No new posts Qmail / SpamControl => Check if DNS exist ? Phibee NOC Qmail 2 Thu Jul 20, 2006 4:51 am
No new posts Power On Self Test Failed: Memory check Blk test failed BertieBigBollox@gmail.com Solaris 0 Wed Jul 19, 2006 9:48 am
No new posts Defining functions in an implementation file westymatt python 2 Tue Jul 18, 2006 7:22 pm
No new posts How to check if a variable contains a " or ` ? Unix-Shell shell 1 Tue Jul 18, 2006 2:10 pm

Loans | Personalized Gifts | Names | Loans | Myspace Comments
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2046s ][ Queries: 20 (0.1068s) ][ GZIP on - Debug on ]