C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to make a library that comples the users to define some

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
jitendar.rawat@gmail.com
Guest





PostPosted: Fri Jan 28, 2005 10:25 am    Post subject: How to make a library that comples the users to define some Reply with quote



Hi,
I am trying to create a library and want its user to define a function
in their executable if that library is linked. some thing like, if some
uses my library and haven't defined a function like

void Initialize( long a, long b)
{
}
at link time I should get an error like "unresolved symbols"
I am able to get it done if I create a dummy fnction in header file of
library which indirectly calls this function, whose decleration is
persent in the library, but no defination is given.
But the loop-hole remains, if some one modifies the header and then
uses the library. I am trying it out on UNIX. Please let me know if
this needs to be posted in the UNIX group. for gcc compiler there is an
option "-rdynamic" , but not finding the same for CC compiler
regards,
Jitu

Back to top
Gernot Frisch
Guest





PostPosted: Fri Jan 28, 2005 2:43 pm    Post subject: Re: How to make a library that comples the users to define s Reply with quote




<jitendar.rawat (AT) gmail (DOT) com> schrieb im Newsbeitrag
news:1106907906.716753.50610 (AT) c13g2000cwb (DOT) googlegroups.com...
Quote:
Hi,
I am trying to create a library and want its user to define a
function
in their executable if that library is linked. some thing like, if
some
uses my library and haven't defined a function like

void Initialize( long a, long b)
{
}
at link time I should get an error like "unresolved symbols"
I am able to get it done if I create a dummy fnction in header file
of
library which indirectly calls this function, whose decleration is
persent in the library, but no defination is given.
But the loop-hole remains, if some one modifies the header and then
uses the library. I am trying it out on UNIX. Please let me know if
this needs to be posted in the UNIX group. for gcc compiler there is
an
option "-rdynamic" , but not finding the same for CC compiler
regards,
Jitu



header:
void foo();
void DoWork();


cpp:

void DoWork()
{
foo();
somework ...
}


if you make a lib, it will call "foo". If you remove it from the
header, you still need it for the linker, since your lib calls it.
-Gernot



Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
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, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.