Ric wrote: ↑Fri 09 Jan 2026, 23:43
do i CALL or SYS the API and in what format.
CALL is (usually) for calling machine code that you have created yourself, typically - but not necessarily - using the built-in assembler. Crucially, it doesn't use a standard ABI but passes its parameters in a block of memory, the contents of which are documented
here.
SYS is (usually) for calling code in an external shared library, such as a
dll in Windows or a
.so ('shared object') in most other OSes. Crucially, it uses the standard ABI defined for the relevant platform, so parameters are passed in the way the called routine expects (which may be in registers and/or on the stack).
I say "usually" in both cases because you
can use SYS to call your own machine code if you prefer (for example if the ABI is more convenient) and you may - although it's less likely - be able to call a shared library routine using CALL if it takes no parameters.
Although there are occasionally situations when it's not straightforward to translate the 'C style' documentation of an API that you will typically find online into equivalent BBC BASIC code, SDL_GetWindowWMInfo() is not one of them and the conversion is direct:
C style:Code: Select all
SDL_bool SDL_GetWindowWMInfo(SDL_Window * window, SDL_SysWMinfo * info);
BBC BASIC style:Code: Select all
SYS "SDL_GetWindowWMInfo", window%%, info{} TO bool%
would it not be better to share your knowlwdge rather than let it go to waste.
Everything I knew I have long since shared, either in the main Help documentation, in the Wiki or here. In the case of the SYS statement, which you seem to be struggling with, there are dozens of examples of its use in the supplied sample programs and libraries. I would particularly point you to the
Accessing the SDL 2.0 API section of the manual.
Sadly I no longer have knowledge to share. In 99% of cases I
do not know (or have forgotten) the answer to questions asked here, and the answers I provide most commonly come from Google. That was the case when you asked about
@hwnd%, I asked Google "how to find the native window handle in SDL2" and it told me about SDL_GetWindowWMInfo(). You could have done the same!
Once upon a time there were several BBC BASIC users just as knowledgeable as I was (more so in respect of some specialised areas such as COM); I would mention Jon Ripley and Malcolm Marten as key examples but they were far from alone. Unfortunately for reasons of their own (I think possibly because at the time BB4W was becoming stagnant and BBCSDL was not yet foreseen) they have 'moved on' to other languages.
But what is essential, especially given my prognosis, is that people learn to stand on their own feet and not be dependant on me to solve their problems. Otherwise, BBC BASIC will die when I do.
