Re: Euphoria Chipmunk Physics

new topic     » goto parent     » topic index » view thread      » older message » newer message
Icy_Viking said...

Ah. I did not think of that. So it seems some more tricks and hacks sorta to speak would be needed in order to make this fully work. Even though Chipmunk is written in C as is Allegro, it seems some libraries are harder to wrap than others. Still a worthy shot, if nothing less. I wonder if Phix might be better at wrapping some of these libraries, it is very similar to Euphoria?

If you can stretch to a teensie weensie bit of inline assembly then yes, Phix would indeed be better.

As well as (and completely independently of) c_func and define_c_func, in Phix you can call directly from inline assembly, with no other declaration required, eg:

function GetLastError() 
integer res 
#ilASM{ 
        call "kernel32.dll","GetLastError" 
        mov [res],eax 
      } 
    return res 
end function 

Unfortunately I have no direct experience with those rarer kinds of C functions, but if you can compile a bit of C, you can disassemble it with demo\pGUI\filedump.exw to see what a call translates to.

Pete

PS For some reason, I also wrote "For cross-platform use, #ilASM also has the guards [32], [64], [PE32], [PE64], ELF32], and [ELF64]" and I refuse to delete it.
Documentation of #ilASM is sketchy (but see phix.chm/internals, especially pLoadFlt..pStoreMint) however there are plenty of examples in builtins\VM
Also I would recommend something like tinycc over something that translates everything to incomprehensible SSE2 instructions

PPS another resource I often use is https://board.flatassembler.net/search.php to see if there is an example for a specific call

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

Search



Quick Links

User menu

Not signed in.

Misc Menu