{"id":19660038,"url":"https://github.com/secana/native-fsharp-library","last_synced_at":"2025-04-28T20:32:05.386Z","repository":{"id":91051099,"uuid":"237636420","full_name":"secana/Native-FSharp-Library","owner":"secana","description":"Create a DLL in F# that can be called by native C++","archived":false,"fork":false,"pushed_at":"2020-02-01T22:16:07.000Z","size":14,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T10:51:09.049Z","etag":null,"topics":["corert","cplusplus","dotnet","dotnet-core","dotnetcore","fsharp"],"latest_commit_sha":null,"homepage":null,"language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/secana.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-01T15:40:18.000Z","updated_at":"2025-01-14T15:16:59.000Z","dependencies_parsed_at":"2023-03-04T21:00:12.364Z","dependency_job_id":null,"html_url":"https://github.com/secana/Native-FSharp-Library","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secana%2FNative-FSharp-Library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secana%2FNative-FSharp-Library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secana%2FNative-FSharp-Library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secana%2FNative-FSharp-Library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/secana","download_url":"https://codeload.github.com/secana/Native-FSharp-Library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251383859,"owners_count":21580955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["corert","cplusplus","dotnet","dotnet-core","dotnetcore","fsharp"],"created_at":"2024-11-11T15:45:04.978Z","updated_at":"2025-04-28T20:32:05.372Z","avatar_url":"https://github.com/secana.png","language":"F#","readme":"# Native F# Library\n\nThis example shows, how you can build an native Windows x64 DLL with *F#* that can be called from native *C++* code.\n\nBlog post which explains how it works: [Writing a native library in F# which can be called from C++](https://secanablog.wordpress.com/2020/02/01/writing-a-native-library-in-f-which-can-be-called-from-c/)\n\nThe example is based on the *C#* version by *Muhammad Azeez* which can be found here: [Writing native libraries in C#](https://mazeez.dev/posts/writing-native-libraries-in-csharp)\n\n## Build \u0026 Run\n\nFirst, the native library has to be build from the *F#* project *NativeLib* in the *src* folder. \nSwitch to the *NativeLib* folder and run:\n\n```powershell\n\u003e dotnet publish /p:NativeLib=Shared -r win-x64 -c Release\n```\n\nThis creates a native library under `$(SolutionDir)src\\NativeLib\\bin\\Release\\netstandard2.0\\win-x64\\native`.\n\nNow, you can build and run the *Console C++* application in *Visual Studio*, which will use the *NativeLib.dll* written in *F#*.\n\nThe output will be:\n\n```powershell\n3\nHello World!\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecana%2Fnative-fsharp-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsecana%2Fnative-fsharp-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecana%2Fnative-fsharp-library/lists"}