从Oracle Forms中的DLL(c#)调用函数

时间:2014-03-04 20:53:44

标签: c# forms oracle dll

我在Oracle Forms 6i中从DLL调用方法时遇到了很大的问题。 DLL已经用

编写

C#,它是代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OnlineFPCommon;
using System.Windows.Forms;

namespace TestNamespace 
{
    public class TestClass
    {
        public static void testMethod()
        {
             MessageBox.Show("testMethod");
        }
    }
} 

我尝试使用Oracle Forms代码调用它:

testlib_lhandle := Ora_Ffi.Load_library('C:\libdir\','test.dll');
getresult_fhandle := ora_ffi.register_function(testlib_lhandle,'testMethod');

但第二行,当我尝试注册函数失败时。为什么?我该如何正确调用该函数?

1 个答案:

答案 0 :(得分:1)

register_function需要一个dll入口点,你无法在托管代码中生成它。

您可以编写C ++ / CLi包装器DLL以获取托管代码的本机入口点,但如果您只是从头开始,那么为什么不编写一个普通的本机dll。