1. Function does not work SDL_thread () in conjunction with machine code?
- Posted by javier07b9 Nov 08, 2010
- 2368 views
constant dato=allocate(8) atom key, t, arg
arg=allocate(8)
dummy = SDL_Init(SDL_INIT_TIMER)
key=SDL_GetKeyState(NULL)
function Thread(atom dato) while peek(dato)=0 do SDL_PumpEvents() end while return 0 end function
t = call_back({'+',routine_id("Thread")})
constant main_bucle=get_asm( "pushad "& "l1: "& "mov al,[key+27] "& "or al,al "& "jz l1 "& "mov [dato],al "& "popad "& "ret") resolve_param("dato",dato) resolve_param("key",key)
poke(dato,0)
dummy=SDL_CreateThread(t,arg) call(main_bucle)
SDL_Quit()
2. Re: Function does not work SDL_thread () in conjunction with machine code?
- Posted by jimcbrown (admin) Nov 08, 2010
- 2318 views
constant dato=allocate(8) atom key, t, arg
arg=allocate(8)
dummy = SDL_Init(SDL_INIT_TIMER)
key=SDL_GetKeyState(NULL)
function Thread(atom dato) while peek(dato)=0 do SDL_PumpEvents() end while return 0 end function
t = call_back({'+',routine_id("Thread")})
constant main_bucle=get_asm( "pushad "& "l1: "& "mov al,[key+27] "& "or al,al "& "jz l1 "& "mov [dato],al "& "popad "& "ret") resolve_param("dato",dato) resolve_param("key",key)
poke(dato,0)
dummy=SDL_CreateThread(t,arg) call(main_bucle)
SDL_Quit()
Euphoria is not compatible with SDL_CreateThread().
3. Re: Function does not work SDL_thread () in conjunction with machine code?
- Posted by javier07b9 Nov 08, 2010
- 2246 views
Thank you very much
4. Re: Function does not work SDL_thread () in conjunction with machine code?
- Posted by euphoric (admin) Nov 08, 2010
- 2303 views
dummy=SDL_CreateThread(t,arg)
Euphoria is not compatible with SDL_CreateThread().
jim, can it be made compatible?
5. Re: Function does not work SDL_thread () in conjunction with machine code?
- Posted by jimcbrown (admin) Nov 13, 2010
- 2209 views
dummy=SDL_CreateThread(t,arg)
Euphoria is not compatible with SDL_CreateThread().
jim, can it be made compatible?
The only (semi-)easy method that I'm aware of, which is highly platform-specific, would be to rebuild eu.a as a shared library and have SDL_CreateThread() call a C or machine code function that reloaded eu.so via dlmopen() specifying to load (or reload) the library in its own namespace.
6. Re: Function does not work SDL_thread () in conjunction with machine code?
- Posted by javier07b9 Nov 20, 2010
- 1928 views
In the end the most practical solution is to use and compile it with WATCOM ECW.exe. Works 100% error-free
7. Re: Function does not work SDL_thread () in conjunction with machine code?
- Posted by jimcbrown (admin) Nov 20, 2010
- 1928 views
In the end the most practical solution is to use and compile it with WATCOM ECW.exe. Works 100% error-free
It might work by chance for a very small program, but make it larger - or simply have both threads run for a long period of time - and you'll get the same sort of crash.