This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#21
I wouldn't merge this just yet - there are a few ugly hacks in this. Wanted to run some ideas by you first.
So, the first thing is that I had to redefine all of the structs and typedefs. This is because they're scattered throughout the codebase in files with C++ code. My suggestion is that these structs and typedefs are instead put in some sort of XXX-Structs.h file or something.
Also, for many of the structs, I had to strip out the C++ convenience functions:
This would be an easy fix, just add
#ifdef __cplusplus
things around the convenience functions.I was also not able to properly expose the classes to C, since classes aren't supported in C. I had to typedef them to void to get it to work:
I might suggest changing these classes into structs, since it seems like OOP isn't being used anyway.
This last one I don't have any idea on how to tackle. Basically, I wrote the C API functions using a bunch of macros that basically called the original function in C++ (the
EXPOSE
macro). However, there's a bit of an issue with the pass-by-reference functions (with the & in the arguments). I can't generate them usingEXPOSE
. So I wrote a workaround for if the function had only pass-by-reference arguments (thePXPOSE
macro, P for pointer). But unfortunately there were about 5 or 6 functions that had mixed pass-by-reference and pass-by-value, which I'd have to write by hand (and would be hell to maintain in the future).My request is that all functions get rid of this pass-by-reference functionality and instead use regular pointers, unless if there's another solution I haven't thought of.