Welcome Guest. Please Login or Register. Apr 5th, 2018, 10:22pm
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
If you require a dump of the post on your message board, please come to the support board and request it.
Programming Windows
« Thread started on: Oct 5th, 2012, 03:14am »
I notice that it is possible to program Windows by either using SYS commands to access the Windows API or using the various Windows libraries provided with BBC Basic. It seems to me that the libraries provide a useful abstraction of the API. Why would one use SYS rather than the libraries? Is it because the libraries only contain a sub-set of the API? Are there any other reasons?
I'm still exploring BBC Basic, hence the question.
Why would one use SYS rather than the libraries? Is it because the libraries only contain a sub-set of the API?
Yes. It would be impractical to wrap every single Windows API in a library (there are many thousands of them!) and it would impact on both program size and speed.
If an API can straightforwardly be called 'inline' from BBC BASIC by means of a simple SYS statement then there is no good reason not to do so. However when the API needs a significant degree of supporting code (perhaps to convert parameters to a different format, or to manage memory buffers, or because some assembler code is required) then wrapping it in a PROC or FN makes sense. If that PROC or FN is likely to be of 'general' use then it is appropriate to put it into a library.
Of course there are very many API calls which aren't straightforward to use but neither is there an existing BB4W library to access them. They are waiting for the need to arise and for somebody to create and submit a suitable library!