Skip to content

DotNET: Implement new bootstrap#1756

Merged
Daztek merged 10 commits intonwnxee:masterfrom
jhett12321:dotnet-refactor
Aug 16, 2024
Merged

DotNET: Implement new bootstrap#1756
Daztek merged 10 commits intonwnxee:masterfrom
jhett12321:dotnet-refactor

Conversation

@jhett12321
Copy link
Copy Markdown
Contributor

This PR introduces a new method of bootstrapping C# assemblies that reduces the boilerplate code in C# & C++, and improves portability with simple C-style exports that matches the convention used by other NWNX plugins.

The updated bootstrapping code is backwards compatible, and should not be ABI breaking.

Comment on lines +33 to +37
function(add_shared_plugin target)
add_library(${target} SHARED ${ARGN})
configure_plugin(${target})
endfunction()

Copy link
Copy Markdown
Contributor Author

@jhett12321 jhett12321 May 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PInvoke cannot accessed exported symbols of "Module" visible libraries, so I added a new function here with different visibility.

We can also change the plugin default to have shared visibility, which would allow C# code to directly call exports from other NWNX plugins.

I can inline this directly in DotNET/CMakeLists if you do not want this added here.

Comment on lines +179 to +182
if (messageType == "ON_NWNX_LOADED")
{
Bootstrap();
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bootstrapping was moved to the end of NWNX init to allow for all enabled NWNX plugins to be loaded, in-case C# code attempts to use exports from other plugins.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files are completely unused by the SWIG build, and can be removed.

@Daztek
Copy link
Copy Markdown
Member

Daztek commented Aug 16, 2024

Is this good to go in? I assume it doesn't beak any existing DotNet stuff?

@Daztek Daztek merged commit 2919e0a into nwnxee:master Aug 16, 2024
@jhett12321 jhett12321 deleted the dotnet-refactor branch August 16, 2024 21:39
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