[GH-ISSUE #4] Loading native library in a cross-platform way. #3

Closed
opened 2026-05-05 10:58:32 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @pauldotknopf on GitHub (Jul 14, 2018).
Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/4

LibGit2Sharp is currently doing it properly: e618156c15/LibGit2Sharp/Core/NativeMethods.cs

The problem is there is no single PInvoke dll name that will work across platform. So, either we have different package (Qt.NetCore.Mac, etc), or we manually search and load the libs our self.

Another option is to use a 3rd party for DLL loading: https://github.com/Firwood-Software/AdvanceDLSupport

AdvanceDLSupport looks interesting, but it would require us to drop SWIG, which I kinda like the idea of. It would give us more control without having to understand the cryptic SWIG definition language.

Using SWIG would make sense if we intended to generate wrappings for the entire Qt layer, which we don't intend on doing. This project is for QML integration only, .NET should be used for everything else.

Removing SWIG would take some time. We are almost at a good/usable point with this project though, I'd like to focus on getting it buttoned up.

Originally created by @pauldotknopf on GitHub (Jul 14, 2018). Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/4 LibGit2Sharp is currently doing it properly: https://github.com/libgit2/libgit2sharp/blob/e618156c150d0bf2c318f5e6fa30b468f63ee45f/LibGit2Sharp/Core/NativeMethods.cs The problem is there is no single `PInvoke` dll name that will work across platform. So, either we have different package (`Qt.NetCore.Mac`, etc), or we manually search and load the libs our self. Another option is to use a 3rd party for DLL loading: https://github.com/Firwood-Software/AdvanceDLSupport `AdvanceDLSupport` looks interesting, but it would require us to drop SWIG, which I kinda like the idea of. It would give us more control without having to understand the cryptic SWIG definition language. Using SWIG would make sense if we intended to generate wrappings for the entire Qt layer, which we don't intend on doing. This project is for QML integration *only*, .NET should be used for everything else. Removing SWIG would take some time. We are almost at a good/usable point with this project though, I'd like to focus on getting it buttoned up.
Author
Owner

@devmil commented on GitHub (Jul 14, 2018):

AdvancedDLSupport looks really promising!
I would propose to try to switching to the final Interop way first before finishing up the rest.
Especially as all the string special treatment might not be needed when we use AdvancedDLSupport.
I also think that the Qt datatypes are hidden in our case as much as possible. All the user code is inside QML or .NET.

<!-- gh-comment-id:405023805 --> @devmil commented on GitHub (Jul 14, 2018): AdvancedDLSupport looks really promising! I would propose to try to switching to the final Interop way first before finishing up the rest. Especially as all the string special treatment might not be needed when we use AdvancedDLSupport. I also think that the Qt datatypes are hidden in our case as much as possible. All the user code is inside QML or .NET.
Author
Owner

@pauldotknopf commented on GitHub (Jul 14, 2018):

After getting the unit test project to work, I'm starting to agree.

It will take a lot of time to get swig removed though :(

I'm going to start looking into it now.

<!-- gh-comment-id:405041949 --> @pauldotknopf commented on GitHub (Jul 14, 2018): After getting the unit test project to work, I'm starting to agree. It will take a lot of time to get swig removed though :( I'm going to start looking into it now.
Author
Owner

@pauldotknopf commented on GitHub (Jul 14, 2018):

Closing. Keep track with #6

<!-- gh-comment-id:405042610 --> @pauldotknopf commented on GitHub (Jul 14, 2018): Closing. Keep track with #6
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/qmlnet#3
No description provided.