lua-users home
lua-l archive

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

I'm for the first time ever trying to make a Lua binding to a package
written in C++, not C. I put my .cc file inside the source library of that
package and compile with this in my Makefile (Ubuntu 14.04):

OFILES = [list of .o files to be compiled for the package]

CPPFLAGS = -fPIC mybinding.o $(OFILES)
    cc -shared -fPIC $(OFILES) mybinding.o -o

The default rule for making an object file comes out as e.g.

g++  -fPIC  -c -o mybinding.o

When I run this, I get:
$ lua -l mybinding
lua: error loading module 'mybinding' from file './':
    ./ undefined symbol: _Z15lua_createtableP9lua_Stateii

This is clearly some C++ mangling of a call to lua_createtable.
I suspect I should make a special Lua executable using g++ as
compiler instead of cc, but this is the point at which I decide to ask
the experts first!