-
-
Notifications
You must be signed in to change notification settings - Fork 133
Quick start
Starting with v1.6 you can configure projects in a few seconds by the following steps below through our manager.
Detailed first configuring looks like:
- Get this (~20 Kbytes) into solution folder. Then, just [Click it] (or command this)
- Select preferred projects to install and configure what you need.
- (optional) Define external storage to get more automation.
- Click [Apply].
Now you're ready to export.
Still not sure? See Various cases in a few steps (Screencast) πΉ
To Upgrade Version, use this command. Or starting with 1.7-RC you can also use GUI updater. [?]
Our .NET DllExport is ready for π .Net Core projects starting with 1.7. [?]
To export something just define DllExport
attribute for your favorite static methods. You can also define specific calling convention and custom name.
β // __cdecl is the default calling convention for our .NET DllExport
π§ͺ Play with demo project (host: unmanaged C++)
[DllExport]
public static void hello() { /* ... */ }
[DllExport]
public static int apply(IntPtr ptr) => 0;
[DllExport("Init", CallingConvention.Cdecl)]
[DllExport(CallingConvention.StdCall)]
[DllExport("MyFunc")]
[<DllExport>]
static member hello() = printfn ".NET DllExport"
[<DllExport>]
static member apply(ptr: nativeint): int = 0
[<DllExport("Init", CallingConvention.Cdecl)>]
[<DllExport(CallingConvention.StdCall)>]
[<DllExport("MyFunc")>]
Merge or provide FSharp.Core module
<DllExport>
Public Shared Sub hello()
' ...
End Sub
<DllExport>
Public Shared Function apply(ByVal ptr As IntPtr) As Integer
Return 0
End Function
<DllExport("Init", CallingConvention.Cdecl)>
<DllExport(CallingConvention.StdCall)>
<DllExport("MyFunc")>
You can configure our tool for any related namespaces in your projects for some additional purpose or just for your convenience in your work.
It's safe because the final modified .NET module (.dll or .exe) will not contain any links with our libraries.
Only primitive/scalar types since this operates under P/Invoke. In any case it will be used through internal marshaling, but non-scalar types may require additional handling as for managed strings.
About default marshaling behavior you can read here: https://docs.microsoft.com/en-us/dotnet/framework/interop/default-marshaling-behavior
You can also try to manually use MarshalAs attribute.
However, scalar types in arguments/return value are a more powerful way to control anything. And this is enough to work with any types like a pointer to allocated data. Means ~ IntPtr
instead of String
etc.
Here you can also find how to use any complex types like structures, or strings: https://www.youtube.com/watch?v=QXMj9-8XJnY (wiki: π Complex types and Strings).
Designed to work with any data from unmanaged memory (including native or binary data from the heap). That's why it can actively help together with .NET DllExport even if you have unmanaged host side to communicate with CLR.
[?] You can even access to complex types like structures without their declaration at all.
Conari also provides various wrappers for types like unmanaged structures, unmanaged strings, and so on. And this is an dynamic way of doing something with any pe-modules (exe, dll) when CLR is host side.
https://github.com/3F/Conari
In Pre-proc tab you can even integrate Conari inside your final modules (no extra .dlls etc) in "one click": https://github.com/3F/DllExport/wiki/PreProc#conari-support
Our examples are waiting for you [ here ]
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 (+πΉ)
- π Configuring
- π First function
- π Data types
- π .Net Core
- π Export
- π Pre-processing
- π Conari support
- π ILMerge support
- π [x]AssemblyResolve
- π Post-processing
- π Examples
- π C++ β€ C# (+πΉ)
- π String & struct (+πΉ)
- π Complete Examples
π
- π DllExport Manager
π
- π’ Q/A