c# не видит функцию из dll Haskell

c# не видит функцию из dll Haskell

Импортируемая библиотека из Haskell:

{-# LANGUAGE ForeignFunctionInterface #-}
module Foo where

import Foreign.C.Types

foreign export ccall
    adder :: CInt -> CInt -> IO CInt

adder :: CInt -> CInt -> IO CInt
adder x y = return (x+y)

Основной код на c#:

using System;
using System.Runtime.InteropServices;

namespace TestXascel
{
    class Program
    {
        [DllImport("Foo.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern void hs_init(IntPtr argc, IntPtr argv);

        [DllImport("Foo.dll", CallingConvention = CallingConvention.Cdecl)]
        private static extern void hs_exit();

        [DllImport("Foo.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int adder(IntPtr x, IntPtr y);

        public static void Main(string[] args)
        {
            Console.WriteLine("Initializing runtime...");
            hs_init(IntPtr.Zero, IntPtr.Zero);
            try
            {
                Console.WriteLine("Calling to Haskell...");
                int result = adder((IntPtr)5, (IntPtr)2);
                Console.WriteLine("Got result: {0}", result);
            }
            finally
            {
                Console.WriteLine("Exiting runtime...");
                hs_exit();
            }
        }
    }
}

Ошибка: System.EntryPointNotFoundException: Unable to find an entry point named 'adder' in DLL 'Foo.dll'


Ответы (0 шт):