views:

494

answers:

3

I downloaded the system.xml.dll, then added it to my Delphi code as following:

uses system.xml;  
etc...

When I try to compile the project, the following message appears:

file not found system.xml.dcu.

Can anyone guide me how to solve this problem?

Thanks.

+5  A: 

The uses clause in Delphi refers to Delphi units, either compiled in a *.dcu file or a *.pas source file that the compiler will use to generate the corresponding *.dcu that is needed.
You cannot just reference the DLL itself.
To use your DLL, you would need at least a unit that would expose in a Pascal way the DLL interface or parts of it.
It can be the Pascal translation of a C header file or just declaring some external routines from the dll to load statically with your program...

What you probably need to reference to work with XML in Delphi are XMLIntf and maybe xmldom.
Have you looked at what the XML Data binding wizard or the XML Mapper Tool can do for you?

Note: I assumed you were working with Delphi Win32. And AFAIK system.xml.dll is part of the .NET world.

François
+3  A: 

If you are using Delphi for .Net you need to add a reference to the system.xml.dll assembly to your project.

Lars Truijens
A: 

If you are using Delphi (Win32), then in order to be able to use .NET assemblies (DLLs), you have the option of using COM interfaces. Follow below steps:

  1. Open the project you want to use it in.
  2. Use Component menu.
  3. Select "Import Type Library"
  4. Select the DLL you want to use.
  5. Follow the next steps as given by wizard.

This will generate a source file which is essentially a wrapper. You can call function of that wrapper as you need.

Please note that using above method will mean that .NET framework must be present on the computer running your application.

Hemant