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

fix typo in opl.h #45

Merged
merged 1 commit into from
Mar 12, 2024
Merged

Conversation

BLumia
Copy link
Contributor

@BLumia BLumia commented Mar 10, 2024

I am reusing the opl.h in my side project for fun, and found this missing extern C issue. This patch adds the missing extern C to make C++ project reuse the opl.h as a header-only library easier. (edit: removed changes related to this according to #45 (comment))

And also corrected a typo.

@mattiasgustavsson
Copy link
Owner

Hmm, I usually don't add "extern C" to my libraries, as they are designed to be compilable with both C and C++, the idea being that if you use them from C, you include implementation from a .c file, and if you use them from C++, you include implementation from a .cpp file. Did you try including implementation in a .cpp file? Did you run into any compilation errors? If so, I would rather fix those than add extern C.

@BLumia
Copy link
Contributor Author

BLumia commented Mar 11, 2024

the idea being that if you use them from C, you include implementation from a .c file, and if you use them from C++, you include implementation from a .cpp file.

Oh, that's okay. I indeed include implementation from a .c file but use them in .cpp file, which lead this issue. I added the extern C because libraries like tml.h, tsf.h, dr_wav.h which are used by this project also did the same thing.

Should I update the patch to only include the typo fix, or simply close this PR?

Thanks!

@mattiasgustavsson
Copy link
Owner

Up to you, I can fix the typo, or if you do it I'll merge the PR

@BLumia BLumia changed the title add extern C {} to opl.h fix typo in opl.h Mar 12, 2024
@BLumia
Copy link
Contributor Author

BLumia commented Mar 12, 2024

Thanks! PR amended :)

@mattiasgustavsson mattiasgustavsson merged commit 2b9c906 into mattiasgustavsson:main Mar 12, 2024
0 of 7 checks passed
@mattiasgustavsson
Copy link
Owner

Thanks!

@BLumia BLumia deleted the opl-extern-c branch March 13, 2024 01:49
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.

2 participants