If the
.lib files you're linking to represent some
.dll files somewhere else, you can do the following:
void main()
{
FunB(); FunC();
typedef void (WINAPI * funa_ptr)(void);
funa_ptr pfunA = ::GetProcAddress(::GetModuleHandle(_T("external_1.dll")), _T("FunA"));
if (NULL == pfunA)
{
}
pfunA();
}
- The linker should not complain, since the conflicting functions are not statically linked.
::GetModuleHandle
should work, since both DLLs were statically linked (and loaded before the .exe where main()
is defined)
If the
.lib files are
static
libraries, you can encapsulate one of them within a DLL of your own, replacing the functions by renamed versions:
void MyFunA()
{
FunA();
}
void MyFunB()
{
FunB();
}
You may link your executable to
external_2.lib, and your DLL to
external_1.lib, thus avoiding name clashes.
Hope this helps.
Pablo writes code for a living, in C++, C#, and SQL.
To make all that work easier, he uses some C++ libraries: STL, ATL & WTL (to write Windows applications), and code generation.
Pablo was born in 1963, got married in 1998, and is the proud father of two wonderful girls.
Favorite quotes:
"Accident: An inevitable occurrence due to the action of immutable natural laws." (Ambrose Bierce, "The Devil's Dictionary", published in several newspapers between 1881 and 1906).
"You are to act in the light of experience as guided by intelligence" (Rex Stout, "In the Best Families", 1950).