Export interface for external call#2131
Export interface for external call#2131TaranDahl wants to merge 4 commits intoPhobos-developers:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a small C ABI “Interop” surface to Phobos so other engine extensions can call into selected Phobos systems at runtime (DLL exports), along with documentation/changelog entries announcing the feature.
Changes:
- Introduces exported interop functions for
TechnoExt::ConvertToTypeand AttachEffect attach/detach/transfer operations. - Wires the new interop sources into the MSBuild project.
- Documents the new interoperability entry in README, Whats-New, and CREDITS.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Interop/TechnoExt.h | Declares exported ConvertToType_Phobos C ABI function. |
| src/Interop/TechnoExt.cpp | Implements the exported type-conversion wrapper. |
| src/Interop/AttachEffect.h | Declares exported C ABI functions for AttachEffect operations. |
| src/Interop/AttachEffect.cpp | Implements exported wrappers for attaching/detaching/transferring effects. |
| docs/Whats-New.md | Adds a changelog entry referencing the new interop feature. |
| README.md | Adds an “Interoperability” section pointing to src/Interop. |
| Phobos.vcxproj | Adds the new interop .cpp/.h files to the build. |
| CREDITS.md | Adds credit entry for the interop export feature. |
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
|
I am not sure why all pointers are |
My bet would be that to make it so that this does not depend on YRpp (in case someone is using their own implementation of YRpp, perhaps) |
Copilot said that if I use TechnoClass*, it will break the P/Invoke compatibility. When calling in C#, I can't directly use IntPtr. I have to do type mapping, otherwise the call will fail. |
This sounds like AI hallucinations...
|
Changed |
|
To Chinese users:
|
|
Macros like PHOBOS_EXPORT and PHOBOS_DECL can make the code cleaner and such macros are widely used in most projects. #define PHOBOS_DECL __stdcall
#define PHOBOS_EXPORT extern "C" __declspec(dllexport) |
Would it be more appropriate to move the Changelog entry of this PR to the Fixes / interactions with other extensions section? |
|
A question: how is the Tested status of this PR determined, as there seems to be no one using another engine extension to try out the content of this PR or other testing information. |
I tested the usability of the initial version myself using DP. However, the current version has not been tested yet. |
DeathFishAtEase
left a comment
There was a problem hiding this comment.
Link redirection is correct.
You may consider filling in the Chinese translation before merging. I have created standard translation entries (don't worry about introducing errors; that will be handled subsequently by the Regular Revisions PR).
|
I think one thing to consider would be the API versioning and backwards compatibility. Usually the APIs are somehow formatting. I am not saying this needs to be done regardless but we may need to employ sth like that. Also, where docs? |
core core Update AttachEffect.cpp update Update README.md Update docs/Whats-New.md update Potential fix for pull request finding Update Macro.h Create .po entries udpate update Update Phobos.vcxproj Co-Authored-By: Noble Fish <89088785+DeathFishAtEase@users.noreply.github.com> Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com> Co-Authored-By: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
What exactly needs to be done?
I assume that engine developers are smart enough to read interface declarations 🤔 |
I mean, you tell me :P I said this as an open question, something to think about.
don't be one of the "just read the code" people :P also interface declaration doesn't say anything about how to set up your project to be able to call Phobos, and we should provide that info |
|
One thing to note: you can write documentation as docstrings, and have Sphinx (doxygen?) generate the corresponding pages. I think there was such an ability. Would be cool to look into that. |
|
If using Sphinx to generate documentation is not convenient, you can first try using forum posts and comments as carriers on the Phobos CN forum and GitHub PR page. |
|
@Metadorius I asked AI to write one. Take a look at it. |
DeathFishAtEase
left a comment
There was a problem hiding this comment.
The current path is incorrect.
Co-authored-by: Noble Fish <89088785+DeathFishAtEase@users.noreply.github.com>
|
|
||
| DEFINE_EXPORT(unsigned int, GetInteropBuildNumber) | ||
| { | ||
| return BUILD_NUMBER; |
There was a problem hiding this comment.
Seems too imprecise (given that it's just 48 right now). Should be a number that increments, yes, but more detailed.
There was a problem hiding this comment.
I also dislike latching on to build numbers which will go away when/if we switch to the proposed versioning
There was a problem hiding this comment.
but more detailed
Is it really necessary to be specific to nightly?
There was a problem hiding this comment.
I also dislike latching on to build numbers which will go away when/if we switch to the proposed versioning
Then what number should be used?
There was a problem hiding this comment.
usually APIs are versioned separately. like v1, v2, v3...
btw, deprecated means "it still works, but a newer method exists which is recommended", not "not working"
Interoperability
Phobos has opened the external interfaces of some key components. If you are also developing your own engine extension and wish to use Phobos at the same time, please check out Interop.