Closed truenotzero closed 11 months ago
Hi, thank you for your pull request!
On my system, this produces the following error during building CSFML:
CSFML/src/Window/Window.cpp: In function ‘void* sfContext_getFunction(const char*)’:
CSFML/src/Window/Window.cpp:152:36: error: invalid conversion from ‘sf::GlFunctionPointer’ {aka ‘void (*)()’} to ‘void*’ [-fpermissive]
152 | return sf::Context::getFunction(name);
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
| |
| sf::GlFunctionPointer {aka void (*)()}
Returning sf::GlFunctionPointer
seems to solve it, but not sure if it has any caveats.
You're absolutely right! That's a bad function declaration, which causes an implicit cast from void(*)()
to void*
(which is illegal in C++).
Weird that my compiler didn't even warn about it...
I updated the code with your suggestion.
Thank you for your contribution!
Ported
sf::Context::getFunction()
:Context::get_function()
Low level details:sfContext_getFunction()
to CSFML implementationsfContext_getFunction()
FFI functionPossible changes: Change
Context::get_function()
's signature, as it currently is:unsafe fn(&CStr) -> *const std::ffi::c_void