sloppycode.net
Creating a native windows DLL
Making DLLs (native) in Delphi 5.


The code below (from 2002!) shows you how to create a simple DLL that can then be reused (see the Using a DLL snippet in the Delphi section). Assuming you are using Delphi 5 (it may or may not differ for earlier versions of Delphi), select File>New and then DLL.

Delphi will then create some code for you, the most notable part of it, is the 'Libary' declaration at the top - this signals that the file is a DLL. You create procedures and functions that can then be used by the application using the DLL.

The procedures and functions that you want to export, have to be declared in the exports section of the code. You can export functions and procedures by index, we won't go into this though. An example of the exports keyword can be seen in the source code. You can also see that a global variable called DLLProc is setup to point to the dllUnload procedure - this is procedure is then responsible for doing any garbage collection when the DLL is unloaded.


› Home
› C#
› Snippets
› Articles
› Tools
› Taglines
› ASP
› Dictionary Object
› FSO
› Unix cheat sheet
› Gaming
› CSS
› Yak
› Umbraco
› About
› Contact
› Privacy
› Projects
› Search
› Sitemap





Buy on Amazon



Buy on Amazon



Buy on Amazon



Buy on Amazon