lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2008/6/24 Wesley Smith <wesley.hoke@gmail.com>:
> Hi list,
> I'm having some problems with symbol mangling in C++ and linking that
> I can't seem to figure out.  I have a C++ template class that uses lua
> API functions.  It serves as my base class for userdata modeling. For
> some reason though, when I inherit from this class, the lua symbols
> used look like this:
>
>  U __Z10luaL_errorP9lua_StatePKcz
>         U __Z10lua_gettopP9lua_State
>         U __Z10lua_insertP9lua_Statei
>         U __Z10lua_rawgetP9lua_Statei
>         U __Z10lua_rawsetP9lua_Statei
>
> I've checked and double checked my code and everywhere I include lua
> headers I have this:
>
> #ifdef __cplusplus
> extern "C" {
> #endif
>
> #include "lua.h"
> #include "lauxlib.h"
>
> #ifdef __cplusplus
> }
> #endif
>
> which leads me to believe that the symbol mangling shouldn't be
> happening.  There aren't any weird compilation settings.  Here's the
> GCC call:
>
> /usr/bin/gcc-4.0 -x c++ -arch i386 -pipe -Wno-trigraphs
> -fpascal-strings -fasm-blocks -g -O0 -fmessage-length=0
> -mfix-and-continue -Wno-deprecated-declarations -Wno-invalid-offsetof
> -mmacosx-version-min=10.4 -DLUA_USE_MACOSX -D__MACOSX_CORE__ -lpthread
> -isysroot /Developer/SDKs/MacOSX10.4u.sdk -c luaOfTexture.cpp -o
> luaOfTexture.o
>
> Any ideas?

Did you try without the #ifdef __cplusplus directives ?