-
Notifications
You must be signed in to change notification settings - Fork 149
Add support for Cocoa OpenGL screen in gfxlib2 and other compiler error fixes for macOS #448
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Conversation
Wow, nice! I'm not sure about frameworks, but I think it should be up to the user whether they want to link to a framework or to a dylib. For example you can either install SDL via homebrew or compile/download a framework. For system frameworks there's no need for a choice, Maybe a new directive to add a framework, with some way to disable it (do I remember that there's now a way to disable/remove libraries added by #inclib?) I'll want to look into the computed goto removal. clang does support computed gotos. Casting a label address to a function pointer and calling it seems very unsafe (or rather, x86-specific). |
Edit: I have traced it to a real llvm bug and I found a workaround for the error _useless:; void* _useless_label = &&_useless; Optionally the variable can be marked as static void FATALOUTOFMEMORY( void )
{
label$2:;
label$4:;
void* vr$0 = fb_ErrorThrowEx( 4, 10, (char*)"src/compiler/list.bas", (void*)0ull, (void*)0ull );
goto *vr$0;
label$5:;
label$3:;
} However, this use of computed goto is undefined behavior per GCC, as this only meant to be used with the addresses of label in this same function taken with
|
Also I forgot to mention that the profiler section name is a problem for mach-o binaries so I have disabled it for now, as I don't what is the best solution. |
@rversteegen Just to be sure when using gfxlib functions like |
596445a
to
236893a
Compare
069e50d
to
d688658
Compare
@rversteegen given what I have found about computed gotos, how do you believe it would be best addressed? |
This PR includes several changes to improve support for the macOS platform in fbc and its libraries. It also aims to add support for OpenGL screens using Cocoa instead of requiring XQuartz for X11 support, although at the time of writing this I haven't tested the implementation very thoroughly yet.
Currently some mechanism similar to
#inclib
but for macOS frameworks is missing. Since a lot of important system libraries contained within frameworks such as OpenGL, this would be useful for headers such asgl.bi
andglut.bi
but also in general. How should this feature be implemented in FreeBASIC?