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

Finalize interfaces before publishing for consumption #4

Open
Ernegien opened this issue Jul 17, 2015 · 2 comments
Open

Finalize interfaces before publishing for consumption #4

Ernegien opened this issue Jul 17, 2015 · 2 comments

Comments

@Ernegien
Copy link
Contributor

Refer to the following article to restructure the interfaces for better usability and expansion. CTRL+F to "Finishing polish" for the good stuff. Any thoughts/concerns?

http://accu.org/index.php/journals/1718

@emoose
Copy link
Contributor

emoose commented Jul 21, 2015

It seems like most of that page is talking about what we'd already planned, creating a new interface when we're adding new functions and giving plugins a way to use the latest interface version with a typedef (seeing as plugin devs shouldn't really have to worry about interface versions and should just be able to use the latest), I added in the typedef (+ a define that refers to the latest version) in 57bb54b

Although they seem to take a step further by also creating new versions of the class as well as the interface, I'm not really sure if we'd need to do that unless there were some drastic changes seeing as the new functions in the class should get mapped to the vftable of the new interface, and the vftables of each interface would be put one after another in the classes actual vftable (ie latest version would be at the end, at least it has from what I've seen), letting us just cast the class between each interface version.
Maybe we'll have to do some further testing to make sure these interface vftables are being placed properly though.

Also while the way we do this is weird, I mostly copied this style of interfaces and the CreateInterface function from Valve, eg. see https://developer.valvesoftware.com/wiki/IGameConsole
The Steamworks SDK also uses the same interfaces system, and I haven't really seen many problems coming from it.

@Ernegien
Copy link
Contributor Author

Yeah, typedefs alone help greatly with readability. As long as we're waterfalling changes to separate versioned interfaces we should be able to somewhat depend on vftable ordering (CTRL+F to "figure 3" in the article), although it appears to be borderline undefined behavior and subject to change. I obviously trust Valve's choices over my limited knowledge on the subject however :)

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

No branches or pull requests

2 participants