modulos en C++ con tolua++

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

modulos en C++ con tolua++

Javier Guerra Giraldez
Hi

I'm trying to do my first non-trivial LuaQT application.  For this i just 
started trying tolua++ (1.0.92). i want to write C++ classes and use them 
from Lua as simple modules.

i already have everything compiled, installed and working.  i can easily write 
the skeleton app in Lua with Qt windows in Linux.

after a few experiments with makefile (zero experience with SCons, and not 
much sympathy for python), i can easily write test C++ classes, apply tolua++ 
and compile as a Lua module.  the only problem is the module initialisation 
function "luaopen_modname()", which isn't 'protected' by a 'extern "C"', so 
when using objdump to see the defined symbols in the loadable library, the 
name is mangled by the g++ compiler.

how's that problem avoided in LuaQt?  the generated C++ code is similar to 
what i get, but the symbol in the library isn't mangled!

-- 
Javier

Attachment: pgpOa8u5NgSG1.pgp
Description: PGP signature

Reply | Threaded
Open this post in threaded view
|

Re: modulos en C++ con tolua++

Fabian Peña
Y no uses como punto de entrada el generado por tolua++
crea uno tu mismo.
Puedes generar tambien el header con tolua++ y poner en tu
fichero principal donde defines el punto de entrada algo asi

#ifdef __cplusplus
extern "C"
#endif
#include "tu_tolua_module.h"
#ifdef __cplusplus
}
#endif


y despues define un punto de entrada con distinto nombre , en el cual
haces el llamada al que genera tolua



List! Sorry for spanish text. :-)



Reply | Threaded
Open this post in threaded view
|

RE: modulos en C++ con tolua++

Carlos Augusto Teixeira Mendes-3
In reply to this post by Javier Guerra Giraldez
Module initialization functions are prefixed with the TOLU_API macro, which is defined with -D on the compilation command line.

Just check the first env.append command int the "SCsub" file on the standard lua Qt distribution.

Carlos Augusto.

Obs: I share your feeling about SCons and Python...

> -----Original Message-----
> From: [hidden email]
> [[hidden email] Behalf Of Javier Guerra
> Sent: Sunday, August 20, 2006 10:44 PM
> To: Lua list
> Subject: modulos en C++ con tolua++
> 
> 
> 
> Hi
> 
> I'm trying to do my first non-trivial LuaQT application.  For this i just 
> started trying tolua++ (1.0.92). i want to write C++ classes and use them 
> from Lua as simple modules.
> 
> i already have everything compiled, installed and working.  i can 
> easily write 
> the skeleton app in Lua with Qt windows in Linux.
> 
> after a few experiments with makefile (zero experience with 
> SCons, and not 
> much sympathy for python), i can easily write test C++ classes, 
> apply tolua++ 
> and compile as a Lua module.  the only problem is the module 
> initialisation 
> function "luaopen_modname()", which isn't 'protected' by a 
> 'extern "C"', so 
> when using objdump to see the defined symbols in the loadable 
> library, the 
> name is mangled by the g++ compiler.
> 
> how's that problem avoided in LuaQt?  the generated C++ code is 
> similar to 
> what i get, but the symbol in the library isn't mangled!
> 
> -- 
> Javier
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.11.4/424 - Release Date: 8/21/2006
>  
>   
> 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.4/424 - Release Date: 8/21/2006
 



Reply | Threaded
Open this post in threaded view
|

Re: modulos en C++ con tolua++

Javier Guerra Giraldez
On Monday 21 August 2006 1:57 pm, Carlos Augusto Teixeira Mendes wrote:
> Module initialization functions are prefixed with the TOLU_API macro, which
> is defined with -D on the compilation command line.
>
> Just check the first env.append command int the "SCsub" file on the
> standard lua Qt distribution.

great!! no problem translating this to make...

-- 
Javier

Attachment: pgpYboYEdww9M.pgp
Description: PGP signature