Re: sdl2 and ffi
- Posted by ghaberek (admin) Dec 05, 2022
- 1309 views
ChrisB said...
produces this
C:\EuProgramming\Euphoria4_1\libffi-euphoria\include\std\ffi.e:910 in function c_func() attempt to subscript an atom (reading from it) - in assignment to 'fn' rid = 1
The problem is that define_c_func() returned -1 for something and c_func() doesn't have good error handling. The first value of m_funcs is an atom because nothing is supposed to exist there. You can add a quick check in c_func() to help find the problem:
override function c_func( integer rid, sequence args ) if rid > 0 then return eu:c_func( rid, args ) end if -- add this: if rid = -1 then machine_proc( M_CRASH, "Invalid C function id: %d", {rid} ) end if rid = rid * -1 atom fn = m_funcs[rid][1] atom cif = m_funcs[rid][2] sequence name = m_funcs[rid][3]
-Greg