在OXYGENE DLL的例子 [英] DLL example in Oxygene

查看:197
本文介绍了在OXYGENE DLL的例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我在哪里可以找到如何使一个DLL(WindowsControlLibrary)在OXYGENE用于.NET的例子吗?
在老德尔福,可以使出口部分。

Can somebody tell me where to find an example in how to make an DLL (WindowsControlLibrary) in Oxygene for .NET?
In the old Delp you make an export section.

推荐答案

要使用Delphi棱镜创建一个非托管的DLL导出,并与2010年德尔福调用它,你必须做到以下几点:

To create an Unmanaged DLL Export using Delphi Prism and call it with Delphi 2010 you must do the following:

在德尔福棱镜:

  1. 文件|新|项目
  2. 在树形视图中选择左边的德尔福棱镜
  3. 选择的Windows类库

preSS确定。

这将为Windows的类库

This will create the template for the Windows Class Library

右键单击该项目ClassLibraryX,然后选择属性:

Right Click on the Project "ClassLibraryX" and Select Properties:

  1. 在兼容性选择允许不安全code
  2. 在构建,发现总科和改变CPU类型为86
  3. 右键单击创建的ClassLibraryX选项卡,选择保存选定项

此设置了项目支持 UnmanagedExportAttribute

然后在code,你需要创建一个类的方法。在下面的例子中我添加了一个参考System.Windows.Forms的。

Then in the code you will need to create a class method. In the example below I added a reference to System.Windows.Forms.

namespace ClassLibrary2;

interface

type
  Class1 = public class
  private
  protected
  public
    [UnmanagedExport('ShowMessage')]
    class method ShowMessage(aMsg : String);
  end;

implementation

class method Class1.ShowMessage(aMsg : String);
begin
 System.Windows.Forms.MessageBox.Show(aMsg);  
end;

end.

使用PEViewer,我用了一个船舶在 JCL 的一个例子,你应该能够看到新的出口。在上述exampeleShowMessage

Using a PEViewer, I used the one that ships as an example in JCL, you should be able to see the new export. In the above exampele "ShowMessage"

这篇关于在OXYGENE DLL的例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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