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

Restore vftable of hsRefCount. #1559

Merged
merged 1 commit into from
Jan 22, 2024
Merged

Conversation

Hoikas
Copy link
Member

@Hoikas Hoikas commented Jan 22, 2024

This restores the vftable of hsRefCount to match its layout in TPotS and the original MOUL. Having these methods be virtual is extremely helpful in the case of ModDLLs that define external creatables. If you're making an external creatable, it's important that those creatables are allocated and deallocated by the ModDLL itself. If UnRef() is not virtual, then your external creatable may be deleted by the engine, which may not be built against the same C++ runtime library as the engine. If the two C++ runtime libraries are not ABI compatible, this can result in sinister crashes. This is most relevant for very, very old builds of the engine, such as TPotS (Visual C++ 6) where it would be nice to build a ModDLL with a newer compiler.

(Yes, this does mean that I have made a ModDLL with an external creatable. The pure virtual function call was very surprising.)

This restores the vftable of `hsRefCount` to match its layout in TPotS
and the original MOUL. Having these methods be virtual is extremely
helpful in the case of ModDLLs that define external creatables. If
you're making an external creatable, it's important that those
creatables are allocated and deallocated by the ModDLL itself. If
`UnRef()` is not virtual, then your external creatable may be deleted by
the engine, which may not be built against the same C++ runtime library
as the engine. If the two C++ runtime libraries are not ABI compatible,
this can result in sinister crashes. This is most relevant for very,
very old builds of the engine, such as TPotS (Visual C++ 6) where it
would be nice to build a ModDLL with a newer compiler.
@Hoikas Hoikas merged commit 80c60a5 into H-uru:master Jan 22, 2024
17 checks passed
@Hoikas Hoikas deleted the refcount_vftable branch January 22, 2024 02:50
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