Build hello_world by Makefile instead of bjam

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

Build hello_world by Makefile instead of bjam

黄延
Hi,
 
    I am new to lua and luabind, just now build the examples hello_world.cpp using bjam successfully. But I am more used to the Makefile/gcc way. I found libluabindd.so ,also libluabindd.a in the strange path ../bin/gcc-4.1/debug/link-static/. How can I build the hello_world.so?
I tryed to link libluabindd.so/libluabindd.a, failed to load my so file in lua5.1.  Can you give me some advise, thank you very much !
 


更多热辣资讯尽在新版MSN首页! 立刻访问!
------------------------------------------------------------------------------

_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Altering a lua-created class member yields strange behavior

Kristoffer Danielsson
Inside LUA I do this:
 
mc = MyClass()
 
This object contains heavy, dynamically allocated, data, which I want to free at some point - inside C++.
 
I tried to keep track of all instances of MyClass inside C++, and then reset the data in all of them. The memory was freed, but I then got weird behavior in my script. (Note: Single-threaded application!)
 
// Stripped sample
class MyClass
{
public:
    MyClass()
    {
         s_instances.insert(this);
    }
   
    virtual ~MyClass()
    {
         s_instances.erase(this);
    }
   
    static set<MyClass*> s_instances;
   
    CData *pData;
};
 
Then, on a given signal, I deallocate pData for each MyClass object inside s_instances, and set the pointer to NULL. As already mentioned, this caused weird logical (!) problems inside my script when returning a table of MyClass pointers (luabind::newtable) and later issuing commands on the CData object (Proxy pattern here, the object is reallocated when used. The sample code is somewhat simplified.).
 
Any ideas, or is this an error on my side?
 
Thanks.


Hitta kärleken lagom till sommaren! Klicka här MSN Dejting
------------------------------------------------------------------------------

_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user