从Oracle Forms中的DLL(c#)调用函数 [英] Invoke function from DLL (c#) in Oracle Forms

查看:303
本文介绍了从Oracle Forms中的DLL(c#)调用函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Oracle Forms 6i中从DLL调用方法有很大的问题。 DLL已经写在



C#中,它是代码:

 使用系统; 
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用OnlineFPCommon;
使用System.Windows.Forms;

命名空间TestNamespace
{
public class TestClass
{
public static void testMethod()
{
MessageBox.Show 测试方法);
}
}
}

我尝试使用Oracle表单代码:

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

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

解决方案

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

您可以编写一个C ++ / CLi包装器DLL来为您的托管代码提供本机入口点,但如果您只是从头开始,那么为什么不只是编写一个简单的本机dll。 / p>

I've got big problem with invoking method from DLL in Oracle Forms 6i. DLL has been written in

C#, and it is code:

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");
        }
    }
} 

I try to invoke it using Oracle Forms code:

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

but the second line, when I try to register function fails. Why? How Can I properly invoke that function?

解决方案

register_function requires a dll entry point and you cannot generate that in managed code.

You can write a C++/CLi wrapper DLL to have native entry points for your managed code but if you are just starting from scratch then why not just write a plain native dll.

这篇关于从Oracle Forms中的DLL(c#)调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆