lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I plan to put all of my scripting code in a Windows DLL, so I must be able to dynamically
load it and unload it at will.  Re-initializing the code is very important.


From: Antonio Scuri <scuri@tecgraf.puc-rio.br>
Reply-To: Lua list <lua@bazar2.conectiva.com.br>
To: Lua list <lua@bazar2.conectiva.com.br>
Subject: Re: Re-initializing IUP v2.3?
Date: Thu, 31 Mar 2005 09:09:30 -0300


The fact is that IUP was not designed to be re-initialized. Maybe in future versions we can improve this.

  Why do you need to re-initialize IUP?

scuri

At 01:00 31/3/2005, R. Frazier wrote:
I need to re-initialize IUP v2.3 and Lua 5.0.2 several times over, (below is just a test setup to see if it works or not), however my program crashes the second time IupClose() is called.
Why is it crashing on IupClose() and what can I do to fix it?

There's two functions that don't have a matching close, iuplua_open(L) and controlslua_open(L),
everything else does.

If I completely remove IUP, re-initialization works. However, it crashes when I put IUP back in. I've already tried to move the order of lines around, but nothing is working.

/////////////////////////////////////////////

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

#include "iup.h"
#include "iuplua.h"
#include "iupcontrols.h"
#include "luacontrols.h"


int TryIt();

void
main() {

TryIt();
TryIt();
TryIt();
}


int
TryIt() {

IupOpen();
IupControlsOpen();

lua_State *L = lua_open();

luaopen_base(L);
luaopen_string(L);
luaopen_table(L);
luaopen_io(L);
luaopen_math(L);
luaopen_debug(L);

iuplua_open(L);
controlslua_open(L);

lua_dofile( L, "test.lua" );

IupMainLoop();

lua_close(L);
L = NULL;

IupControlsClose();
IupClose();

return 1;
}

_________________________________________________________________
Designer Mail isn't just fun to send, it's fun to receive. Use special stationery, fonts and colors. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*.


_________________________________________________________________
Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*.