在 PowerBuilder 12.5.2 中使用 C# 创建的 DLL [英] Use C# created DLL in PowerBuilder 12.5.2

查看:83
本文介绍了在 PowerBuilder 12.5.2 中使用 C# 创建的 DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Visual Studio 2015 企业版创建了一个面向 .Net Framework 4.5.2 的简单 C# 类库,其中一个类.

I have created a simple C# class library targetting .Net Framework 4.5.2 with one class using Visual Studio 2015 enterprise edition.

示例代码:

namespace PwdEncryptor
{
    public class Class1
    {
        public string Encrypt (string actualPassword)
        {
           return String.Concat(actualPassword, "Encrypt");
        }
    }
}

我想在另一个系统上使用我的powerbuilder代码中的这个.

I want to use this from my powerbuilder code on another system.

这样做的目的是为了获得密码加密的通用代码.

Purpose of doing this is to have common code for encryption of password.

问题:

我在我的 powerbuilder 代码中使用了它,方法是在全局实例变量中声明如下:

I used it in my powerbuilder code by declaring in the Global instance variables like this:

函数字符串 Encrypt(string actualPassword) 库PwdEncryptor.dll"

Function string Encrypt(string actualPassword) Library "PwdEncryptor.dll"

在我写的应用程序的打开事件中:

And in Open event of the application I wrote:

string pwd
pwd = Encrypt("XYZ")

当我运行代码时,我收到一条消息说未知函数名称"

When I ran the code, I got a message saying "Unknown function name"

为了克服这个问题,我尝试了提到的解决方案 这里.我采取的一个小偏差是,我没有在导出创建的注册表的同一系统上执行 powerbuilder导入到存在 powerbuilder 代码的其他系统.在这种情况下,我得到的错误是 Bad runtime function reference at line in Open event of Application object.

To overcome this I tried the solution mentioned here. A small deviation that I took was instead of doing the execution in powerbuilder on the same system I exported the registry which was created & imported to other system where powerbuilder code exists. In this case the error that I got was Bad runtime function refernce at line in Open event of Application object.

有没有办法可以使用我创建的 DLL?我错过了什么吗?请指教.

Is there a way that I can possibly use the DLL I have created? Am I missing something? Please advise.

推荐答案

我已经解决了这个问题.

I have resolved this.

而不是从我的系统中导出注册表 &将它导入包含 powerbuilder 代码的系统上,我应该使用 RegAsm.exe

Instead of exporting the registry from my system & importing it on the system containing powerbuilder code, I should have registered my C# dll using RegAsm.exe

一旦注册了 DLL,PowerBuilder 代码就可以使用 C# 代码了.

Once the DLL is registered, the PowerBuilder code is able to use the C# code.

这篇关于在 PowerBuilder 12.5.2 中使用 C# 创建的 DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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