• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • Last Modified:

Creating a DLL.

I want to create a DLL. I select from menu File|New|DLL. Then I edit the "Library". And then?
0
val84
Asked:
val84
  • 2
  • 2
1 Solution
 
rwilson032697Commented:
You would do something like this:

Write a procedures/functions to do what you want, eg:

library MyDLL;

// Etc

function CalculateSomething(AnArgument : Double) : Double; cdecl;

begin
  result := <Some calculation>
end;

end.

Lets call the DLL 'MyDLL.DLL'.

You could use this DLL in an application like this:

unit MyDLL;

interface

Function CalculateSomething(AnArgument : Double) : Double; cdecl;

implementation

Function CalculateSomething(AnArgument : Double) : Double; cdecl; external 'MyDLL.DLL' name 'CalculateSomething';
end;

end.

In some unit of your program you can add the MyDLL unit to the uses clause and call the function like this:

CalculateSomething(1.2);

Cheers,
Raymond.
0
 
val84Author Commented:
Hi Raymond.
My problem is this: when I try to create a DLL, as I told you before, Delphi opens a "Project1.dpr" window. But I want to create a .DLL not a .DPR.
What am I supposed to do?
Alex.
0
 
rwilson032697Commented:
The project is always a .DPR file. When you compile the DLL project the result will be a .DLL file!

Cheers,

Raymond.
0
 
val84Author Commented:
Hi Raymond.
It worked OK. All is well that ends well.
Thanks, Alex.
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now