Replies: 1 comment 1 reply
-
In modern .NET the handling of different names is meant to be handled via SetDllImportResolve This gives you the string used for |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When using ClangSharpPInvokeGenerator, we can specify the name of the dynamic link library in the DllImport attribute using "--libraryPath" as a string.
For example:
we will got:
Sometimes, using just a string to specify the name of the dynamic link library (DLL) isn't sufficient, especially when considering cross-platform scenarios.
Scenario 1: Different Names on Different Platforms
In this scenario, the dynamic library has different names on different platforms, and we need to decide at runtime which name to use:
To handle this situation, one approach is to define a variable or configuration that specifies the library name, and then allow users to customize this variable based on the platform or specific runtime conditions.
For example, in your code or configuration:
Then, in your DllImport attribute, use this variable:
This allows flexibility to define the correct library name based on the platform or runtime conditions.
Scenario 2: Library Name Contains Dot (.)
In this scenario, the library name itself contains a dot (.), which means we must specify the full name including the file extension (dll or so) to ensure DllImport succeeds:
Beta Was this translation helpful? Give feedback.
All reactions