MSVC名称修改和链接(使用Bullet Physics)

时间:2014-08-26 12:28:59

标签: c++ linker bulletphysics name-mangling

我正在尝试在项目中使用Bullet Physics引擎,并在链接过程中遇到问题。

此符号不可用(链接器错误):

  

"" void * __cdecl btAlignedAllocInternal(unsigned __int64,int)" (?btAlignedAllocInternal @@ @ YAPEAX_KH Z)"在Funktion"" public:static void * __cdecl btCollisionObject :: operator new(unsigned __int64)" (?? 2btCollisionObject @@ @ SAPEAX_K Z)"

我用过

  

E:\ SDKs \ bullet-2.82-r2704 \ lib> dumpbin / symbols BulletDynamics.lib | findstr / R /   C:" btAlignedAllocInternal"

检查符号是否可用,结果:

  

17F 00000000 UNDEF notype()外部|   ?btAlignedAllocInternal @@ YAPAXIH @Z(void * __cdecl   btAlignedAllocInternal(unsigned int,int))121 00000000 UNDEF notype   ()外部| ?btAlignedAllocInternal @@ YAPAXIH @Z(void *   __cdecl btAlignedAllocInternal(unsigned int,int))07A 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))0AF 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))0B6 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))07F 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))308 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))16B 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))279 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))2C7 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))3C6 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))249 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))675 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))39E 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))24D 00000000 UNDEF notype()External | ?btAlignedAllocInternal @@ YAPAXIH @Z(无效   * __cdecl btAlignedAllocInternal(unsigned int,int))

对我来说,看起来这个符号不可用(不匹配错位的名字),但我必须承认,我实际上并不知道如何创建错位的符号名称。

你能解释YAPAXIH和YAPEAX_KH之间的区别吗? 或者是否有人有其他建议可能出错?

1 个答案:

答案 0 :(得分:2)

对于MSVC来说,名称错位似乎相当模糊。我使用了demangler.com并获得了以下内容:

for?btAlignedAllocInternal @@ YAPEAX_KH @ Z

  

void * __ptr64 __cdecl btAlignedAllocInternal(unsigned __int64,int)

for?btAlignedAllocInternal @@ YAPAXIH @ Z

  

void * __cdecl btAlignedAllocInternal(unsigned int,int)

功能定义是

void* btAlignedAllocInternal(size_t size, int alignment);

这清楚地表明存在x64 / x86问题。实际上,子弹是使用x86构建的。