Extern functions inside library

K

karthy

Hi,
i have a C library with 3 files :
file1.c, file2.c, file3.c
The function, ext_func() that is needed by both file1.c and file2.c is
in file3.c
I have made that function as extern.
Accidentally an application in which this library is integrated also
has a function by name ext_func(). When my library calls ext_func()
from within, the control goes to the ext_func() defined in the
application and not to the one defined in the library.
Can i solve this problem without changing the function name in the
library and that in the application?
i donot want to expose the function, ext_func() outside my library.
 
I

Ico

karthy said:
Hi,
i have a C library with 3 files :
file1.c, file2.c, file3.c
The function, ext_func() that is needed by both file1.c and file2.c is
in file3.c
I have made that function as extern.
Accidentally an application in which this library is integrated also
has a function by name ext_func(). When my library calls ext_func()
from within, the control goes to the ext_func() defined in the
application and not to the one defined in the library.
Can i solve this problem without changing the function name in the
library and that in the application?
i donot want to expose the function, ext_func() outside my library.

There is no portable way of doing this with the current files you are
using now. A workaround wold be to Make the function static in the same
file where it is called; this way it will not be visible beyond file
scope, and it's symbol is not exported to other parts of the program.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,518
Latest member
RomanGratt

Latest Threads

Top