简体   繁体   中英

(Lua+iOS) Error to use lua_pushstring

==============
Info Develope:
MacOS 10.6 SnowLeopard
iOS SDK 5.0
FreePascal 2.6.0 for MacOS X
FreePascal 2.6.0 for iOS
XCode 4.2
Device: iPad
Lua: Object library = liblua.a (ver 5.14) 
==============

Code:

A) lua_pushnumber(LuaInstance, 5);
B) lua_pushstring(LuaInstance, 'TEST');
C) lua_pushlstring(LuaInstance, 'TEST', 4);

Problem: When I use variant "B" and "C", and launch project on my iPad, the application blink on start and close with next error:

(iPad) Error in console log:

Exited with code: 217
<Warning> Application 'demo1' exited abnormally with exit status 217

For variant "A", everything alright and application launch normal.

Interesting, when I compile and lanch on simulator, all variants ("A", "B", "C") works, without crash.

Can anybody knows why, application crash on device for lua_pushstring?

May be someone dealt with this problem without freepascal, may be on c++. Help me, please.

I noticed, when I add printf to func lua_pushlstring, problem fixed. Why?

LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
  lua_lock(L);
  luaC_checkGC(L);
  printf ("Test= %s ", s);  
  setsvalue2s(L, L->top, luaS_newlstr(L, s, len));
  api_incr_top(L);
  lua_unlock(L);
}

Perhaps addressing violation occurs, when linking liblua.a?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM