Skip to content
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

gladegl.cpp: fixes for C code as cpp #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

puffnfresh
Copy link

For some reason this file is .cpp (and for me compiled with g++) but it didn't have the right headers and the rest of the code expected it to export C calls.

Alternatively, we could change the build and make this just C.

@devernay devernay self-requested a review March 19, 2023 17:53
Copy link
Member

@devernay devernay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • never use extern "C" { before includes
  • I don't see what's wrong with the previous code, unless you were including gladegl.h from C source files. This is all C++, so let's keep it that way
  • The only valid change would be to error if gladegl.h is included from C

@puffnfresh
Copy link
Author

@devernay no, it's not just from including in C files, the use is here:

extern "C" {
extern int gladLoadGL(void);
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
extern int gladLoadEGL(void);

It's an explicit extern "C". I don't know why but it's consistent with gladLoadGL so I didn't want to change it.

I even question why it's an extern, can't we include gladegl.h? Nothing else does! Very confusing.

@f-dy
Copy link

f-dy commented Mar 20, 2023

The proper solution would be to declare it as extern c in the header file, and include the header file everywhere it's being used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants