-
-
Notifications
You must be signed in to change notification settings - Fork 133
Quick start
Denis Kuzmin [ github.com/3F ] edited this page Dec 29, 2017
·
13 revisions
Start with:
DllExport
-action Configure
## Configuring the projects
Since v1.6 provides [new embeddable manager](DllExport-Manager), you can configure your projects in a few seconds by the following steps below.
1. Get [DllExport.bat](https://3F.github.io/DllExport/releases/latest/manager/)
2. Use command `-action Configure`
3. Select some available projects for install operations and configure this as you need.
4. (optional) Define storage for settings.
4. Click [Apply].
Now you're ready to provide exported-functions for unmanaged environments from .NET projects.
## Exports
To create your first function: Just define `DllExport` attribute for your favorite **static** methods.
For example:
```csharp
[DllExport]
public static void hello() { }
```
```csharp
[DllExport]
public static int hello(IntPtr ptr)
{
return 0;
}
```
You can also define specific calling convention and custom name:
```csharp
[DllExport("Init", CallingConvention.Cdecl)]
// __cdecl is the default calling convention for our library as and for C and C++ programs
[DllExport(CallingConvention.StdCall)]
[DllExport("MyFunc")]
```
## What types ?
Do not use complex types for arguments & for return value.
Only primitive types.
You should use pointer to allocated data for complex types if you need.
For example, `IntPtr` instead of `String`.
Related:
* [Issue 25](https://github.com/3F/DllExport/issues/25)
* [Issue 30](https://github.com/3F/DllExport/issues/30)
* [Conari](https://github.com/3F/Conari)
Except where otherwise noted, wiki content is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. (CC BY-SA 4.0).
🗎
- 🗎 Home
- 🗎 Quick start (+📹)
- 🗎 .Net Core
- 🗎 Export
- 🗎 Pre-processing
- 🗎 Conari support
- 🗎 ILMerge support
- 🗎 [x]AssemblyResolve
- 🗎 Post-processing
- 🗎 Examples
- 🗎 C++ ❤ C# (+📹)
- 🗎 String & struct (+📹)
- 🗊 Complete Examples
🗔
📂
- 📢 Q/A