[ create a new paste ] login | about

Link: http://codepad.org/DKDKgovE    [ raw code | fork ]

C, pasted on Jan 28:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
open System
open System.Runtime.InteropServices
open Microsoft.FSharp.NativeInterop

[<System.Runtime.InteropServices.DllImport("pgm_cpp.dll", EntryPoint="add", CallingConvention=CallingConvention.Cdecl)>]
extern void add(byte[] a, byte[] b);

let add2 (x: int) (y: int) =
    let a,b = BitConverter.GetBytes x, BitConverter.GetBytes y
    add(a,b)

// declaration
// extern "C"  __declspec(dllexport) void add(int a, int b);
// definition
// void add(int a, int b) { printf("Why?"); }


Create a new paste based on this one


Comments: