Skip to content

Commit

Permalink
Select target framework (#163)
Browse files Browse the repository at this point in the history
* Minor refactoring

* Introduce new setting for selecting target framework

* Use `IntPtr` where possible

* Fix path

* Throw if unsupported .NET

* ignore ffi files in C# examples

* Fix config file

* Add constructor for function pointer

* Use `IntPtr` in Bindgen.Runtime
  • Loading branch information
lithiumtoast authored May 7, 2024
1 parent 8bf03b3 commit 0957668
Show file tree
Hide file tree
Showing 38 changed files with 1,281 additions and 2,657 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ lib/
*.so

# c2ffi artifacts
src/cs/examples/**/ffi/
src/cs/examples/**/ffi-x/
src/c/tests/**/ffi/
src/c/tests/**/ffi-x/

Expand Down
2 changes: 1 addition & 1 deletion src/cs/C2CS.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{56
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "helloworld", "helloworld", "{24028D61-CCE1-4893-9BD6-1D7C28563DC8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "helloworld-compile-c-library-and-generate-bindings", "examples\helloworld\helloworld-compile-c-library-and-generate-bindings\helloworld-compile-c-library-and-generate-bindings.csproj", "{841E561C-B3BB-499B-AEB3-0874ACDDB2BC}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "helloworld-bindgen", "examples\helloworld\helloworld-bindgen\helloworld-bindgen.csproj", "{841E561C-B3BB-499B-AEB3-0874ACDDB2BC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C2CS.Tool", "production\C2CS.Tool\C2CS.Tool.csproj", "{1B67F4A2-24E6-43A6-A031-918DD44CD991}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// To disable generating this file set `isEnabledGenerateAssemblyAttributes` to `false` in the config file for generating C# code.

// <auto-generated>
// This code was generated by the following tool on 2024-04-10 18:55:28 GMT-04:00:
// This code was generated by the following tool on 2024-05-07 16:36:40 GMT-04:00:
// https://github.com/bottlenoselabs/c2cs (v0.0.0.0)
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
Expand All @@ -11,7 +11,7 @@
#nullable enable
#pragma warning disable CS1591
#pragma warning disable CS8981
using bottlenoselabs.C2CS.Runtime;
using Bindgen.Runtime;
using System;
using System.Collections.Generic;
using System.Globalization;
Expand All @@ -20,7 +20,11 @@
#endregion

#if NET7_0_OR_GREATER
// NOTE: Disabling runtime marshalling is preferred for performance improvements. You can learn more here: https://learn.microsoft.com/en-us/dotnet/standard/native-interop/disabled-marshalling
[assembly: DisableRuntimeMarshalling]
#endif

#if (NETCOREAPP1_0_OR_GREATER) || (NET45_OR_GREATER || NETFRAMEWORK && (NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472 || NET48)) || (NETSTANDARD1_1_OR_GREATER || NETSTANDARD && !NETSTANDARD1_0)
// NOTE: Only takes effect on Windows. Specifies the recommended maximum number of directories (the application directory, the %WinDir%\System32 directory, and user directories in the DLL search path) to search for native libraries. You can learn more here at (1) https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.defaultdllimportsearchpathsattribute and (2) https://learn.microsoft.com/en-ca/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa#parameters
[assembly: DefaultDllImportSearchPathsAttribute(DllImportSearchPath.SafeDirectories)]
#endif
Loading

0 comments on commit 0957668

Please sign in to comment.