 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
jitendar.rawat@gmail.com Guest
|
Posted: Fri Jan 28, 2005 10:25 am Post subject: How to make a library that comples the users to define some |
|
|
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
|
Posted: Fri Jan 28, 2005 2:43 pm Post subject: Re: How to make a library that comples the users to define s |
|
|
<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 |
|
 |
|
|
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
|
|