Re: Problem with Writing Wrapper
- Posted by jimcbrown (admin) Jun 07, 2013
- 1201 views
Lone_EverGreen_Ranger said...
Hello,
I am trying to test my SFML 2.0 wrapper that I wrote for Euphoria. Every time I try to use a function or procedure call from it, it says it has been not declared. For example, in the below code, it says sfClock_create has not been declared. Here is my code. Anyone know why I would be getting these errors, even though they are declared. I'm using Windows 7 64-bit, Eu 4.0.5
Your code doesn't declare the function. You need to declare it (and make it public). E.g.
include std/machine.e include std/dll.e constant EXIT_SUCCESS = 1 constant EXIT_FAILURE = 0 atom sf_sys = open_dll("csfml-system-2.dll") if sf_sys = -1 then puts(1,"Could not open csfml-system-2.dll!\n") abort(0) end if constant xsfClock_create = define_c_func(sf_sys,"sfClock_create",{},C_POINTER) public function sfClock_create() return c_func(xsfClock_create, {}) end function
Remember, C functions are not visible to Euphoria code. You must interface via c_func()/c_proc().