-
Notifications
You must be signed in to change notification settings - Fork 5
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
add support for linux #10
Conversation
@@ -8,11 +8,88 @@ namespace SoulsFormats | |||
public static class Kernel32 { | |||
[DllImport("kernel32", SetLastError = true)] | |||
static extern IntPtr LoadLibraryW([MarshalAs(UnmanagedType.LPWStr)]string lpFileName); | |||
|
|||
[DllImport("kernel32.dll")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this still have the ".dll" ending, given that it was removed from the other instances of DllImport?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's no kernel32.dll in linux, this line is just fine.
Actually, we use public static class Libdl
in linux instead.
I'm not sure if netstandard could use the latest NativeLibrary.Load
and/or LibraryImport, if so, we could simplify some code here.
Looks interesting. We've kept compatibility to netstandard and netcore for the sake of having cross-platform capability, and this seems to move us closer to that goal. Have you personally tested it? How would you suggest to test it? |
Yes, I've test on my wsl ubuntu.
~/workspace/linoodle % ls build
CMakeCache.txt CMakeFiles Makefile cmake_install.cmake liblinoodle.so liboodle_26.so liboodle_28.so oo2core_6_win64.dll pe-parse testlinoodle
# test
~/workspace/linoodle % cp /path/to/game/oo2core_6_win64.dll bin/Debug/net8.0/ && ./build/testlinoodle ./build/liboodle_26.so
Test succeeded!
~/workspace/MyProject % dotnet build
...
~/workspace/MyProject % cp ../linoodle/liboodle_26.so bin/Debug/net8.0/liboo2core_6_win64.so
~/workspace/MyProject % cp /path/to/game/oo2core_6_win64.dll bin/Debug/net8.0/
# if this doesn't work, you might need set LD_LIBRARY_PATH
~/workspace/MyProject % export LD_LIBRARY_PATH="$PWD/bin/Debug/net8.0:$LD_LIBRARY_PATH" |
Some note here: On linux we import
Then when |
By using https://github.com/McSimp/linoodle, we could load oo2core_8_win64.dll on linux