Problem binding free functions.

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

Problem binding free functions.

nickelplate
I get an annoying linker error when trying to register free functions.
When I register the same functions as methods of a class, everything
works fine. I'm using Visual C++ Express 2005 and the Luabind Beta 7
(built as a dll with VC++ Express; my project is a dll as well).

RegisterCore.obj : error LNK2019: unresolved external symbol "public:
void __thiscall
luabind::detail::free_functions::function_rep::add_overload(struct
luabind::detail::free_functions::overload_rep const &)"
(?add_overload@function_rep@free_functions@detail@luabind@@QAEXABUoverload_rep@234@@Z)
referenced in function "public: virtual void __thiscall
luabind::detail::function_commiter<char const * (__cdecl*)(void),struct
luabind::detail::null_type>::register_(struct lua_State *)const "
(?register_@?$function_commiter@P6APBDXZUnull_type@detail@luabind@@@detail@luabind@@UBEXPAUlua_State@@@Z)




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem binding free functions.

Arvid Norberg
On Jan 11, 2006, at 12:27, nickelplate wrote:

> I get an annoying linker error when trying to register free  
> functions. When I register the same functions as methods of a  
> class, everything works fine. I'm using Visual C++ Express 2005 and  
> the Luabind Beta 7 (built as a dll with VC++ Express; my project is  
> a dll as well).
>
> RegisterCore.obj : error LNK2019: unresolved external symbol  
> "public: void __thiscall  
> luabind::detail::free_functions::function_rep::add_overload(struct  
> luabind::detail::free_functions::overload_rep const &)" (?
> add_overload@function_rep@free_functions@detail@luabind@@QAEXABUoverlo
> ad_rep@234@@Z) referenced in function "public: virtual void  
> __thiscall luabind::detail::function_commiter<char const *  
> (__cdecl*)(void),struct luabind::detail::null_type>::register_
> (struct lua_State *)const " (?register_@?
> $function_commiter@P6APBDXZUnull_type@detail@luabind@@@detail@luabind@
> @UBEXPAUlua_State@@@Z)

It looks like that function (or rather struct) isn't marked for dll  
export. That is probably a mistake. Could you try changing line 90 in  
luabind/function.hpp from:

    struct function_rep

into:

    struct LUABIND_API function_rep

and see if that helps?

--
Arvid Norberg




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem binding free functions.

nickelplate
Arvid,

thank you for responding so quickly. Marking the struct for dll export
solved the problem.


Arvid Norberg wrote:

> On Jan 11, 2006, at 12:27, nickelplate wrote:
>
>> I get an annoying linker error when trying to register free  
>> functions. When I register the same functions as methods of a  class,
>> everything works fine. I'm using Visual C++ Express 2005 and  the
>> Luabind Beta 7 (built as a dll with VC++ Express; my project is  a
>> dll as well).
>>
>> RegisterCore.obj : error LNK2019: unresolved external symbol  
>> "public: void __thiscall  
>> luabind::detail::free_functions::function_rep::add_overload(struct  
>> luabind::detail::free_functions::overload_rep const &)" (?
>> add_overload@function_rep@free_functions@detail@luabind@@QAEXABUoverlo
>> ad_rep@234@@Z) referenced in function "public: virtual void  
>> __thiscall luabind::detail::function_commiter<char const *  
>> (__cdecl*)(void),struct luabind::detail::null_type>::register_
>> (struct lua_State *)const " (?register_@?
>> $function_commiter@P6APBDXZUnull_type@detail@luabind@@@detail@luabind@
>> @UBEXPAUlua_State@@@Z)
>
>
> It looks like that function (or rather struct) isn't marked for dll  
> export. That is probably a mistake. Could you try changing line 90 in  
> luabind/function.hpp from:
>
>    struct function_rep
>
> into:
>
>    struct LUABIND_API function_rep
>
> and see if that helps?
>
> --
> Arvid Norberg
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> luabind-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
>



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Problem instantiating class in Lua.

nickelplate
In reply to this post by Arvid Norberg
I'm using luabind beta 7 built as a dll with Boost 1.33.1 and VC++
Express 2005.

I have created three classes, exposed to luabind as follows (several
methods omitted for brevity):

    class_<RGB>("RGB")
        .def(constructor<>())
        .def(constructor<real>())
        .def(constructor<const XYZ&>())
        .def(constructor<real, real, real>())
        ,
    class_<XYZ>("XYZ")
        .def(constructor<>())
        .def(constructor<real>())
        .def(constructor<const RGB&>())
        .def(constructor<real, real, real>())
        ,
    class_<Spectrum>("Spectrum")
        .def(constructor<>())
        .def(constructor<const RGB&>())
        .def(constructor<const XYZ&>())

I can instantiate RGB and XYZ objects fine in Lua, but only the Spectrum
default constructor works.

For instance, if I do this:

    spectralColor = Spectrum(RGB(1.0, 0.0, 0.0))

I get the following assert in debug mode:

Assertion failed: (steps >= 0) && "internal error, please report", file
..\..\..\..\src\class_rep.cpp, line 1521

I get the same error passing an XYZ object as parameter to the Spectrum
constructor.

What am I doing wrong?



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user