Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Delphi
Hi all
 
I'm a complete newby to Delphi. Using RAD Studio XE. I am used to Visual Studio.
 
I created a project group and added a third party library. I created a new project with a GUI for experimenting.
 
I am just wondering how to add a reference from my GUI project to the Library project? In visual studio, you'd click "Add Reference" and find the referenced project.
Posted 16-May-11 15:02pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Delphi "Project group" is the concept similar to Visual Studio Solution.
 
If you use Delphi and not Delphi Prizm, it means you're not developing .NET assemblies but you're developing native Windows code. For native Windows, there is no a concept of assembly and there is no a concept of references.
 
Unfortunately, you can use only less robust lower-level concept of exporting and importing methods, which are not even object-oriented. (You can simulate very basic object-oriented features via explicit passing of "self" parameters, but this is an advanced technique which requires good understanding of OOP internals.) You can also use Delphi concept of package which is technically based on native import/export but ideologically close to .NET (Delphi is a major .NET predecessor). But packages are between Delphi projects. Let's talk about consuming native DLL in Delphi. Import is performed in source code using external key word.
 
Here is a simple example:
 
procedure DllMessage; external 'SimpleMessageDLL.dll';
 
Find a full code sample here:
http://delphi.about.com/od/windowsshellapi/a/dll_basics.htm[^].
 
Alternatively, you can load a DLL during run-time using Windows API LoadLibrary/LoadLibraryEx and access DLL methods using GetProcAddress. See:
http://msdn.microsoft.com/en-us/library/ms684175(v=vs.85).aspx[^],
http://msdn.microsoft.com/en-us/library/ms684179(v=vs.85).aspx[^],
http://msdn.microsoft.com/en-us/library/ms683212(v=vs.85).aspx[^].
 
—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 334
1 Kornfeld Eliyahu Peter 325
2 Maciej Los 239
3 OriginalGriff 188
4 King Fisher 185
0 OriginalGriff 6,303
1 DamithSL 4,764
2 Maciej Los 4,306
3 Kornfeld Eliyahu Peter 3,914
4 Sergey Alexandrovich Kryukov 3,538


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 16 May 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100