lua-users home
lua-l archive

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



* On 2008-05-20 Chunlin Zhang <zhangchunlin@gmail.com> wrote  :

> Ico Doornekamp wrote:
>>
>> * On 2008-05-20 chunlin zhang <zhangchunlin@gmail.com> wrote  :
>>
>>> Many of the C runtime lib api could not be used in this platform
>>> especially "stdio.h",i.e.: malloc/free/realloc printf/fprintf
>>> fopen/fread/fwrite/fclose remove/rename/tmpfile(the platform have
>>> its own file system api with UTF16 string parameter)
>>
>>> I spent 1 night to compile lua into the platform.  And spent 2 day
>>> to run "hello world"(using luaL_dostring) in the PC  emulator.
>>> Spent 3 day to run "hello world" in mobile phone,because found that
>>> I  should get rid of the C runtime api not support in the platform.
>>>
>>> And now I want to run lua script from file(using luaL_dofile),and
>>> found  that I should rewrite luaL_loadfile and so on with platform
>>> utf16 string  file system api.I think I will spend more days...
>>>
>>> Have anyone else ever done this kind of porting?Or any advice to
>>> me...
>>
>> I think there are generally two ways of porting Lua to a platform
>> like yours: one is to just start compiling, find where the build
>> breaks, and modify the Lua code to use your platform-specific API
>> instead of the standard C library functions. This is a lot of work,
>> and in the end leaves you with a severely modified Lua
>> implementation, which will not make future updates any easier.
>
> Any code using the C runtime lib api can be compile in this
> platform. But i.e. the call of "malloc/free" make the mobile phone can
> not boot normally, and I don't know why exactly.

If I were you I'd focus on finding out why this is the case before
making an difficult effort porting code which relies heavily on these
functions. It would make your life a lot easier if these functions are
just available and work as they should. Don't you have a platform or OS
vendor who can support you on this issue ?

-- 
:wq
^X^Cy^K^X^C^C^C^C