You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 18, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,4 +46,23 @@ so you can build a dll that will contain your code that get called from the `C#
46
46
47
47
For demonstration purposes we will use meson/ninja to create a new `C++ project` and clang or msvc to compile it, but you can use your preferred toolchain (for example CMake) to build the dll.
48
48
49
-
in this example project it will show a dialog box for simplicity.
49
+
in this example project it will show a dialog box for simplicity.
50
+
51
+
## Loading c++ code from C#
52
+
53
+
after the dll is compiled, you can use it from the C# project.
54
+
55
+
- Copy the `c++ dll(and all the required files)` to the `C# project` binary folder.
56
+
> This step can be automated with a build script, as it is only needed when you deploy the release of the application.
57
+
- Add the following import to the `C# code`.
58
+
```csharp
59
+
// DllImport
60
+
usingSystem.Runtime.InteropServices;
61
+
```
62
+
- then add the function of the `C++ DLL` in the `C# code` like this:
63
+
```csharp
64
+
// define the DLL entry point from c++ dll (void dllEntry() from myApp.dll)
0 commit comments