0

So I'm trying to compile a big project that uses PIN and Python. The problem is that PIN has some types that are the same than the ones in Python.

So what I did is creating a namespace PIN:: to avoid having ambiguous symbol errors.

So now the code compiles fine but the linker is not finding the PIN symbols since it tries to find them using my custom PIN:: namespace and the lib file does not have it.

Here is the error:

1>main.obj : error LNK2001: unresolved external symbol "void __cdecl PIN::LEVEL_PINCLIENT::PIN_UnlockClient(void)" (?PIN_UnlockClient@LEVEL_PINCLIENT@PIN@@YAXXZ)

Can I specify the linker that it needs to search for LEVEL_PINCLIENT::PIN_UnlockClient(void) instead of PIN::LEVEL_PINCLIENT::PIN_UnlockClient(void) ??

Cheers

Community
  • 1
  • 1
user1618465
  • 1,813
  • 2
  • 32
  • 58

1 Answers1

1

One way to solve the linker problem is to create your own DLLs that act as wrappers to PIN and Python.

In the PIN wrapper DLL, create the PIN namespace and add the wrapper functions in that namespace. Same with the Python wrapper DLL.

From rest of your code, use functions from namespace PIN and namespace Python.

R Sahu
  • 204,454
  • 14
  • 159
  • 270
  • Hi, That may work but there is a lot of functions that I will need to "wrap" if I want this to work... Is not any way to tell the linker to use a specified name when it search for a function in a library? – user1618465 Jan 21 '16 at 23:07
  • If there are two DLLs that have the same symbol name, how would you tell the linker to use one DLL for one call but the second DLL for another call? – R Sahu Jan 21 '16 at 23:09
  • Ok, so here is the question: Is there any way to tell the linker to remove the `PIN::` namespace when it tries to search for functions in the lib?? Thanks! – user1618465 Jan 21 '16 at 23:27
  • @user1618465, I don't think there is such a feature in the linker. Remember that the linker deals with mangled names. It has no knowledge of C++ namespaces. – R Sahu Jan 21 '16 at 23:30