byondapi.h (personally tested v.515.1621, although by Atomix's account 516.1651 doesnt work either) doesnt compile when using a c compiler
Numbered Steps to Reproduce Problem:
1. compile
Code Snippet (if applicable) to Reproduce Problem:
> gcc -x c .\any_use_of_api.c
.\byondapi\byondapi.h:129:8: error: expected identifier or '(' before string constant
129 | extern "C" {
| ^~~
Expected Results:
no breakage
Actual Results:
breakage
Does the problem occur:
Every time? Or how often? yes
In other games? correct
In other user accounts? indeed
On other computers? bacon
When does the problem NOT occur?
after removing the extern "C" binding and extensively tweaking the header file
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
probably not
Workarounds:
use cpp
You should also be using directives to make the code more robust and seamless.
You'd also do this at the top where you check to see if c++ is NOT being used, and thus add the header for C files.
Also the last problem is for the "Byond_ThreadSync(ByondCallback callback, void *data, bool block=false)" function.
bool block = false is not valid C syntax. So you'd need two versions, one that is used if you're using c++, or one that adjusts the arguments to work for C. I imagine block would be a pointer to a bool value, and in the function you'd check if block is NULL to set it to the proper value at the top of the function call.