Invoke function from DLL (c#) in Oracle Forms

2019-03-04 01:49发布

问题:

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?

回答1:

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.