-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Glk C++ compatibility #2
Comments
Adding Adding |
Great news on As for void (*put_string)(char *) = glk_put_string; That will become invalid, and while it's probably not something anybody is doing, it's possible. It's also a trivial fix, but if it's being used in the wild, I can understand trepidation in forcing a change. But I understand that it's a big job. If it's at least something that might be acceptable, I'm willing to do the conversions to see what kind of problems might occur, and if you deem it acceptable, I'd provide pull requests/patches. If it's a hard "no" then I won't bother taking the time, but otherwise I'd find it worth trying, even if the end result is to keep the status quo. |
I've run into a couple issues while working with Glk in C++.
glk.h
header (at https://www.eblong.com/zarf/glk/glk.h) provides C++ (mangled) names when used with a C++ compiler. Client code can, of course, wrap the include inextern "C"
, but it would be very convenient if insteadglk.h
itself had such a declaration, wrapped in#ifdef __cplusplus
.char *
parameter whereconst char *
would be preferred. This is actually not strictly a C++ issue, given that it's reasonable in C to useconst char *
for safety, and then be forced to cast tochar *
, but it's more pronounced in C++ where string literals have type "array of const char" instead of "array of char".I request that the offical Glk header file be updated to be more friendly to C++. These changes shouldn't affect existing programs which make use of Glk, except perhaps if a pointer to one of the
char *
-accepting functions is being stored... but that's probably unlikely, and would be easy to change.The text was updated successfully, but these errors were encountered: