Page 1 of 1
SDL3.4 and Intel-Mac (import xcframework)
Posted: Tue Mar 03, 2026 7:38 pm
by GPI
I have installed the SDL3-Framework from the original-git-hub:
https://github.com/libsdl-org/SDL/relea ... ease-3.4.2
and with Windows/Linux everything works, but on a Intel it will crash (unexpected debugger termination).
Simple example-code
Code: Select all
importc "/Library/Frameworks/SDL3.xcframework/macos-arm64_x86_64/SDL3.framework/SDL3"
endimport
debug "test"
Re: SDL3.4 and Intel-Mac (import xcframework)
Posted: Tue Mar 03, 2026 11:47 pm
by kenmo
Looks like you're importing an Arm library on an Intel system... what do you expect should happen? (Serious question. Not sarcastic. I'm no expert on these libraries and also I use Mac less than Linux/Windows.)
Re: SDL3.4 and Intel-Mac (import xcframework)
Posted: Wed Mar 04, 2026 4:38 pm
by GPI
As far as I understand it is a combined lib for ARM64, X86 and X64. A "universal binary".
But I think that this could be the main problem, that Purebasic can't handle universal binary libs...
Re: SDL3.4 and Intel-Mac (import xcframework)
Posted: Thu Mar 05, 2026 7:59 am
by Fred
We use the standard linker, so it should handle it
Re: SDL3.4 and Intel-Mac (import xcframework)
Posted: Fri Mar 06, 2026 4:28 pm
by Piero
GPI wrote: Tue Mar 03, 2026 7:38 pmimportc
Code: Select all
; SDL 3 Test
Procedure.s UpperDir(path$, level = 1, setcurrdir = #False) ; get enclosing folder (multilevel)
Protected i, oldcurrdir$ = GetCurrentDirectory()
path$ = GetPathPart(path$) ; in case of file
For i = 1 To level : path$ + ".." + #PS$ : Next
SetCurrentDirectory(path$)
path$ = GetCurrentDirectory()
If Not setcurrdir : SetCurrentDirectory(oldcurrdir$) : EndIf
ProcedureReturn path$
EndProcedure
Macro dq : "
EndMacro
Macro Fun(f,i=0)
Global f#._#f = GetFunction(i, dq#f#dq)
EndMacro
PrototypeC.i _SDL_Init(flags.l)
PrototypeC _SDL_Quit()
PrototypeC _SDL_PumpEvents()
PrototypeC.i _SDL_CreateWindowAndRenderer(*title, width.i, height.i, window_flags.l, *pWindow, *pRenderer)
PrototypeC _SDL_DestroyRenderer(*renderer)
PrototypeC _SDL_DestroyWindow(*window)
PrototypeC.i _SDL_SetRenderDrawColor(*renderer, r.a, g.a, b.a, a.a)
PrototypeC.i _SDL_RenderClear(*renderer)
PrototypeC _SDL_RenderPresent(*renderer)
; To make a standalone .app, copy SDL3.framework into your app.
; Put it into folder: your.app/Contents/Frameworks/ (needed only once!)
; Then you can use:
; If OpenLibrary(0, UpperDir(ProgramFilename())+"Frameworks/SDL3.framework/SDL3")
If OpenLibrary(0, "SDL3.framework/SDL3") ; Framework on source folder for debugging
Fun(SDL_Init)
Fun(SDL_Quit)
Fun(SDL_PumpEvents)
Fun(SDL_CreateWindowAndRenderer)
Fun(SDL_DestroyRenderer)
Fun(SDL_DestroyWindow)
Fun(SDL_SetRenderDrawColor)
Fun(SDL_RenderClear)
Fun(SDL_RenderPresent)
If (SDL_Init($20))
If (SDL_CreateWindowAndRenderer(UTF8("SDL3 Test"), 640, 480, 0, @*win, @*ren))
SDL_SetRenderDrawColor(*ren, 0, 255, 0, 255)
SDL_RenderClear(*ren)
SDL_RenderPresent(*ren)
For i=0 to 99
SDL_PumpEvents() ; fix for Mac
Next
Delay(2000)
SDL_DestroyRenderer(*ren)
SDL_DestroyWindow(*win)
EndIf
SDL_Quit()
EndIf
EndIf
PS:

Re: SDL3.4 and Intel-Mac (import xcframework)
Posted: Sat Mar 07, 2026 3:53 am
by kenmo
GPI wrote: Wed Mar 04, 2026 4:38 pm
As far as I understand it is a combined lib for ARM64, X86 and X64. A "universal binary".
But I think that this could be the main problem, that Purebasic can't handle universal binary libs...
Sounds good, sorry for doubting you. I am using SDL3 successfully on Linux and Windows but via the OpenLibrary() method, not ImportC method.