以下の内容はhttps://fsharp.hatenablog.com/entry/ExternalFunctionsより取得しました。


外部関数

外部関数 External Functions

元ネタ http://msdn.microsoft.com/ja-jp/library/dd393785.aspx

次のエクスポート関数を含むネイティブ C++ DLL があると仮定します。

#include <stdio.h>
extern "C" void __declspec(dllexport) HelloWorld()
{
    printf("Hello world, invoked by F#!\n");
}

この関数は、次のコードを使用して F# から呼び出すことができます。

F#

open System.Runtime.InteropServices

module InteropWithNative =
    [<DllImport(@"C:\bin\nativedll", CallingConvention = CallingConvention.Cdecl)>]
    extern void HelloWorld()

InteropWithNative.HelloWorld()

書き方は C# でも F# でも同じ。

C#

using System.Runtime.InteropServices;

class InteropWithNative
{
    [DllImport(@"C:\bin\nativedll", CallingConvention = CallingConvention.Cdecl)]
    public static extern void HelloWorld();
}

class Program()
{
    void Main()
    {
        InteropWithNative.HelloWorld();
    }
}



以上の内容はhttps://fsharp.hatenablog.com/entry/ExternalFunctionsより取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14