Page 1 of 1

Attaching external C/C++ libs with lua bindings

Posted: Tue Jan 19, 2010 7:30 am
by MistaED
Hello,

I was wondering what the best way it is to attach external C/C++ libraries which already have lua bindings made for it in order for it to be exposed to the love lua interpreter. Would it be best to add it to love as a "library" (like how luasocket is implemented) or as a module?

My end goal I'm guessing would be to compile-in the actual binding code into the love runtime and have it access the dll dynamically, but does this binding code need anything special inside to interface with? I only know a tiny bit of C/C++ code, enough to hack around a few things and I'm familiar with building code the "unix" way. I could be over-complicating things and if it's as easy as just adding the binding code to love, linking the external lib, and hit compile, please tell me! :)

Thanks all

Re: Attaching external C/C++ libs with lua bindings

Posted: Tue Jan 19, 2010 5:59 pm
by rude
If you want to make a C++ library which uses LÖVE objects natively, you probably want to get the source and create a custom version of LÖVE. If you want to create something which operates separately (like LuaSocket), then create a normal Lua library (e.g. a DLL). In both cases, you will have to distribute binaries for each platform. You can't put a native library in a .love.

Re: Attaching external C/C++ libs with lua bindings

Posted: Thu Jan 21, 2010 6:04 am
by MistaED
Thanks for the info rude. Looking more into it the library I want to integrate would most likely benefit from having access to however the window context creation is made and the physfs filesystem library at the C++ level, so I need to rethink on how to integrate this in-code so it has a nice API exposed to lua.

This would help if I was more confident in C++, hehe.