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

问题描述 投票:0回答:1

我在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');

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

c# forms oracle dll
1个回答
1
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.