Re: sdl2 and ffi

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thanks Greg, my mistake, fixed it. I was using version 2.0 of the SDL DLL instead of version 2.26. Still leaves that atttempt to subscript atom waiting to rear it's ugly head.

[edit] - ah, sorry, mfuncs is the sequence, in this instance rid is an index to it.

These are the fixes I made

in SDl_version.e

--export constant xSDL_GetVersion = define_c_proc(sdl,"+SDL_GetVersion",{SDL_version}) 
export constant xSDL_GetVersion = define_c_proc(sdl,"+SDL_GetVersion",{C_POINTER}) 
--public procedure SDL_GetVersion(sequence ver) 
public procedure SDL_GetVersion(atom ver_ptr) 
end procedure 

in cpu_demo.ex

--Show CPU Info Demo 
include std/ffi.e 
include sdl.e 
printf(1, "System RAM %d Gb\n", {SDL_GetSystemRAM()}) 
--get the dll version we are using 
atom DLL_vers 
DLL_vers = allocate_struct(SDL_version, {0,0,0})   --allocate the memory, and return the pointer to that memory 
printf(1, "DLL versio : %d.%d.%d\n)", { 
        peek(DLL_vers),                     --single byte, 8 bit numbers 
        peek(DLL_vers + 1), 
        peek(DLL_vers + 2) 
puts(1,"1 Means True, 0 Means False\n") 
printf(1,"CPU Count: %d\n",{SDL_GetCPUCount() }) 
printf(1,"Cache Line Size: %d\n",{SDL_GetCPUCacheLineSize() }) 
printf(1,"Has RDTSC: %d\n",{SDL_HasRDTSC() }) 
printf(1,"Has AtltiVec: %d\n",{SDL_HasAltiVec() }) 
printf(1,"Has MMX:%d\n",{SDL_HasMMX() }) 
printf(1,"Has 3D Now:%d\n",{SDL_Has3DNow() }) 
printf(1,"Has SSE:%d\n",{SDL_HasSSE() }) 
printf(1,"Has SSE2:%d\n",{SDL_HasSSE2() }) 
printf(1,"Has SSE3:%d\n",{SDL_HasSSE3() }) 
printf(1,"Has SSE41:%d\n",{SDL_HasSSE41() }) 
printf(1,"Has SSE42:%d\n",{SDL_HasSSE42() }) 
printf(1,"Has AVX:%d\n",{SDL_HasAVX() }) 
printf(1,"Has AVX2:%d\n",{SDL_HasAVX2() }) 
printf(1,"Has AVX512F:%d\n",{SDL_HasAVX512F() }) 
printf(1,"Has ARMSIMD:%d\n",{SDL_HasARMSIMD() }) 
printf(1,"Has NEON:%d\n",{SDL_HasNEON() }) 
printf(1,"Has LSX:%d\n",{SDL_HasLSX() }) 
printf(1,"Has LASX:%d\n",{SDL_HasLASX() }) 
printf(1,"RAM: %d\n",{SDL_GetSystemRAM() }) 

I'm afraid these types being squirted at the C functions are a big issue a the moment, as far as I can tell, all the SDL_ routines need pointers of structures as parameters, not types, or actual structures, and the SDL library is littered with these, you can't send the ffi types - yet.



new topic     » goto parent     » topic index » view thread      » older message » newer message


Quick Links

User menu

Not signed in.

Misc Menu