在 PowerBuilder 12.5.2 中使用 C# 创建的 DLL

编程入门 行业动态 更新时间:2024-10-25 11:20:15
本文介绍了在 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

本文发布于:2023-10-31 01:47:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1544628.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:PowerBuilder   DLL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!