Skip to content

secana/Native-FSharp-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Native F# Library

This example shows, how you can build an native Windows x64 DLL with F# that can be called from native C++ code.

Blog post which explains how it works: Writing a native library in F# which can be called from C++

The example is based on the C# version by Muhammad Azeez which can be found here: Writing native libraries in C#

Build & Run

First, the native library has to be build from the F# project NativeLib in the src folder. Switch to the NativeLib folder and run:

> dotnet publish /p:NativeLib=Shared -r win-x64 -c Release

This creates a native library under $(SolutionDir)src\NativeLib\bin\Release\netstandard2.0\win-x64\native.

Now, you can build and run the Console C++ application in Visual Studio, which will use the NativeLib.dll written in F#.

The output will be:

3
Hello World!

Releases

No releases published

Packages

No packages published