0
votes

I am trying to use the Bullet Physics engine in my project and have a problem during linking.

This symbol is not available (linker error):

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

I used

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

to check if the symbol is available, result:

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

To me, it looks like the symbol is not available (not matching mangled names), but I have to confess, I do not actually know how the mangled symbol names are created.

Can you explain where the differences between YAPAXIH and YAPEAX_KH? Or does anyone have an other suggestion what might be wrong?

1
Look at demangler: demangler.com BTW, usually linker problems are solved by more simple way. For example, did you add .lib file to the linker dependencies list?Alex F
Thank you for demangler.com. Yes, if I delete the .lib, I get an other error.Dirk
Some problems with bitness? Looking at demangled functions you posted, maybe it is about x86 - x64 compatibility.Alex F
Might be so, I use the same compiler on the same machine, but I'll have a look.Dirk
size_t is different in x86 and x64 builds. Maybe you build x64, and .lib and .dll are for x86 (Win32).Alex F

1 Answers

2
votes

Name mangling seems to be rather obscure for MSVC. I used demangler.com and got the following:

for ?btAlignedAllocInternal@@YAPEAX_KH@Z

void * __ptr64 __cdecl btAlignedAllocInternal(unsigned __int64,int)

for ?btAlignedAllocInternal@@YAPAXIH@Z

void * __cdecl btAlignedAllocInternal(unsigned int,int)

The function definition is

void* btAlignedAllocInternal(size_t size, int alignment);

This clearly indicates that a x64/x86 issue exists. Indeed, bullet was build using x86.