Attaching external C/C++ libs with lua bindings

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
MistaED
Prole
Posts: 3
Joined: Mon Jan 18, 2010 2:34 am

Attaching external C/C++ libs with lua bindings

Post 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
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

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

Post 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.
MistaED
Prole
Posts: 3
Joined: Mon Jan 18, 2010 2:34 am

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

Post 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.
Post Reply

Who is online

Users browsing this forum: 101Corp, Semrush [Bot] and 1 guest