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.