1. Problem with Writing Wrapper
- Posted by Lone_EverGreen_Ranger Jun 07, 2013
- 1227 views
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
EuSFML.ew (include file)
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) function sfClock_create() return c_func(xsfClock_create,{}) end function
The test code
include EuSFML.ew atom clock clock = sfClock_create()
2. Re: Problem with Writing Wrapper
- Posted by ssallen Jun 07, 2013
- 1202 views
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
EuSFML.ew (include file)
constant xsfClock_create = define_c_func(sf_sys,"sfClock_create",{},C_POINTER)
xsfClock needs to be scoped public.
public constant xsfClock_create = define_c_func(sf_sys,"sfClock_create",{},C_POINTER)
3. Re: Problem with Writing Wrapper
- Posted by jimcbrown (admin) Jun 07, 2013
- 1202 views
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().
4. Re: Problem with Writing Wrapper
- Posted by Lone_EverGreen_Ranger Jun 07, 2013
- 1195 views
I did declare it. Sorry I forgot to put down some of the code. Also, I'm still getting the not declared error.
5. Re: Problem with Writing Wrapper
- Posted by ssallen Jun 07, 2013
- 1219 views
We are going to need to see the rest of your code to help with that. Can you show us the current code?
6. Re: Problem with Writing Wrapper
- Posted by Lone_EverGreen_Ranger Jun 07, 2013
- 1192 views
I figured it out. I need to make all the functions and declrations public.