Skip to content

Feature: implement support for Linux and macOS on .NET Core 8+#24

Open
IsaMorphic wants to merge 12 commits into
JeremyAnsel:mainfrom
IsaMorphic:feature/impl-linux-support
Open

Feature: implement support for Linux and macOS on .NET Core 8+#24
IsaMorphic wants to merge 12 commits into
JeremyAnsel:mainfrom
IsaMorphic:feature/impl-linux-support

Conversation

@IsaMorphic

@IsaMorphic IsaMorphic commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

This PR introduces support for the Linux and macOS versions of 7-Zip by leveraging the NativeLibrary wrapper API provided by .NET Core. Unused kernel32.dll APIs are also removed to make sure that cross-platform support is viable. Since 7-Zip does not use native COM, all the other code should work as expected on all platforms.

Unit tests are also adapted to support Unix file paths (i.e. using slashes instead of backslashes) and, importantly, string marshalling code now uses correct character sizes across all platforms.

Fixes #22. Tested on WSL2 Ubuntu 24.04 and modern macOS. Not all 7-Zip features supported on Windows are supported cross-platform. Check SharpSevenZipLibraryManager.CurrentLibraryFeatures to see what's available on your platform.

@IsaMorphic IsaMorphic force-pushed the feature/impl-linux-support branch 3 times, most recently from 1fd0b36 to 8d8c596 Compare June 5, 2026 16:55
@IsaMorphic IsaMorphic force-pushed the feature/impl-linux-support branch from 22b0502 to 90d1009 Compare June 5, 2026 18:21
@IsaMorphic

Copy link
Copy Markdown
Contributor Author

Key issues that have yet to be addressed in this PR are the size mismatch of wchar_t between Windows and Linux, specifically impacting string marshalling. There may be more issues once this is resolved but I believe it's the main one.

@IsaMorphic IsaMorphic marked this pull request as ready for review June 8, 2026 19:16
@IsaMorphic

Copy link
Copy Markdown
Contributor Author

@JeremyAnsel this is ready for review. Thank you for your collaboration!

@JeremyAnsel

Copy link
Copy Markdown
Owner

LGTM.
I saw you removed support for .net 6. I am fine with that change.
I wait for @jhudsoncedaron for testing. Once it is confirmed that it works on Linux I will merge this PR.
Thank you for your work.

Comment thread SharpSevenZip/SharpSevenZip/SharpSevenZipCompressor.cs Outdated
@IsaMorphic

Copy link
Copy Markdown
Contributor Author

Just tested this on macOS. Works there as well!

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.

Package declared to run anwhere but can only ever possibly work on Windows

3 participants