wxLua can use require("wx") as module, was Re: lots of junk...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

wxLua can use require("wx") as module, was Re: lots of junk...

John Labenski
Oops, sorry about the messed up title.

On 5/13/06, Jérôme VUARAND <[hidden email]> wrote:

> With mingw you can do exactly the same to build a wx.dll Lua module :
> wx.dll: luamodule.cpp $(OBJECTS) $(LUA_LIBS) wxLuaLib wxLuaDebugLib
> wxLuaSocketLib wxLuaBindings
>         $(CXX) $(CXXFLAGS) $(APPEXTRADEFS) -g -O -shared -o wx.dll -fpic \
>         $(LDLIBS) $(APPEXTRALIBS) \
>         luamodule.cpp
> The only extra thing you have to do is to check that all your
> -l$(XXXLIB) point to existing libraries. These libraries can either be
> static libs, or dll import libraries. Static libs are exactly like on
> unix (-lfoo need libfoo.a). Dll import libraries are necessary if you
> want to link dynamically to a dll. You can generate libfoo.a from
> foo.dll with the following commands :
>         impdef foo.dll > foo.def
>         libtool --kill-at --dllname foo.dll --input-def foo.def --output-lib libfoo.a
>         rm foo.def
> These import libraries may already exist in the wxWidget build tree if
> you built it with mingw.
> Feel free to ask if I'm not clear. I had a hard time finding docs on
> the subject since everything on mingw site is outdated, but now I
> think I know the subject well.

That's great. I've never tried to use mingw, but maybe I'll give a go
using cygwin. What you described sounds very simple, pretty much
identical to what I do for linux.

I'm at a loss about MS Visual Studio though, I think it may be a
little more complicated, but I dunno?

Thanks for the tips,
    John Labenski

> 2006/5/13, John Labenski <[hidden email]>:
> > You need to use the current CVS HEAD of wxLua. The snapshots are
> > broken since Sourceforge has changed things recently and I'm not sure
> > how to reimplement what we had.
> >
> > In the wxLua/apps/luamodule dir is code to make lua require"wx" work in Linux.
> >
> > You create the wx.so library by running $make in the
> > wxLua/apps/luamodule/src dir and all of wxLua will be created for you.
> > The output wx.so lib is just dumped in the src dir for now.  The
> > Makefile uses the wx-config script and therefore it MUST be in your
> > path. Additionally it puts the resultant wxLua libs it creates in the
> > appropriate lib dir of wxWidgets so it must be writeable. As a
> > developer I never bother to install wxWidgets, but if you have you'll
> > have to hack the Makefiles located in each XXX/src dir to output them
> > elsewhere. The Makefiles are fairly straightforward so this shouldn't
> > be difficult. Eventually we'll get the bakefile's configure to work
> > with this new project.
> >
> > A sample program called luamodule.wx.lua in that dir shows it working
> > by simply creating a wxFrame. Test it from the
> > wxLua/apps/luamodule/src dir using
> > $../../../bin/lua luamodule.wx.lua
> >
> > -----------------------------------------
> > Help for MSW
> >
> > For non wxWidgets, wxLua users: We create 3 libs for wxLua and
> > wxWidgets itself has about a half a dozen libs that need to be linked
> > to the resultant shared lib for lua's require, if I understand
> > correctly.
> >
> > I don't really understand completely what I've done, but it seems to
> > work. See apps/luamodule/src/Makefile and the wx.so: tag. I guess I'm
> > compiling the luamodule.cpp file, linking it with all the other libs,
> > and then creating a .so library using -shared. I think also that -fpic
> > is needed.
> >
> > I haven't the foggiest idea about how to do the same in MSW, I guess
> > it should be a DLL? But then how do you "link" this DLL to all of the
> > wxLua and wxWidgets DLLs or can you create the wxLua and wxWidgets
> > libs as libs and link them to the DLL?
> >
> > Maybe someone who uses lua's require more regularly can shed some light on this?
> >
> > Regards,
> >    John Labenski
> >