Can somebody tell me where to find an example in how to make an DLL (WindowsControlLibrary) in Oxygene for .NET?
In the old Delphi, you make an export section.
DLL example in Oxygene
2k views Asked by Frank Sidor At
2
There are 2 answers
0
On
If you whant to make it compatible with delphi then you have to indicate a "stdcall" Calling Convention
namespace ClassLibrary2;
interface
type Class1 = public class
private
protected
public
[UnmanagedExport('ShowMessage'), System.Runtime.InteropServices.CallingConvention.StdCall]
class method ShowMessage(aMsg : String); end;
implementation
class method Class1.ShowMessage(aMsg : String);
begin
System.Windows.Forms.MessageBox.Show(aMsg);
end;
end.
To create an Unmanaged DLL Export using Delphi Prism and call it with Delphi 2010 you must do the following:
In Delphi Prism:
Press OK.
This will create the template for the Windows Class Library
Right Click on the Project "ClassLibraryX" and Select Properties:
This sets up the project to support the UnmanagedExportAttribute.
Then in the code you will need to create a class method. In the example below I added a reference to System.Windows.Forms.
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"