1. Problem with Writing Wrapper

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() 
 
new topic     » topic index » view message » categorize

2. Re: Problem with Writing Wrapper

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

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) 
new topic     » goto parent     » topic index » view message » categorize

3. Re: Problem with Writing Wrapper

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().

new topic     » goto parent     » topic index » view message » categorize

4. Re: Problem with Writing Wrapper

I did declare it. Sorry I forgot to put down some of the code. Also, I'm still getting the not declared error.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Problem with Writing Wrapper

We are going to need to see the rest of your code to help with that. Can you show us the current code?

new topic     » goto parent     » topic index » view message » categorize

6. Re: Problem with Writing Wrapper

I figured it out. I need to make all the functions and declrations public.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu