CrossTalk Archive

CrossTalk Project Files – *.ctp

CrossTalk Project Files – *.ctp

.ctp extension defines a CrossTalk Project file. CTP files list assemblies and classes that you want to expose to your Delphi code. The CrossTalk ClassGen uses the project file to generate Delphi wrappers.

GUI Editor

Currently there is not GUI and you must define the ctp file using a text editor. Fortunately the text file is simple and easy to manipulate. In the future a GUI editor for CTP files will exist.

Creating a CTP File

CrossTalk ships with some sample CTP files. You can also create your own very easily. Create a new text file, and change the extension to .ctp. Now edit it with a text editor such as Notepad.

Here is a sample CTP file.

3.0

GAC:System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
USER:C:sourceCrossTalksourceCrossTalkRightTestbinDebugCrossTalkRightTest.dll

#You can stick comments in this area with #
CrossTalkRightTest.DataSet1+CountryDataTable
CrossTalkRightTest.DataSet1+CountryRow
CrossTalkRightTest.DataSet1
CrossTalkRightTest.MyClass
System.Data.DataRow
System.Data.DataRowCollection
System.Text.StringBuilder
System.Xml.XmlReader
System.Xml.XmlReaderSettings
System.Xml.ConformanceLevel
System.Xml.XmlNodeType

Currently the CTP file consists of 3 sections, each terminated by a blank line or end of file. The sections in order are Header, Assembly List, and Class List.

Header Section

The header currently contains only one.

The first line contains the version of the project file. This enables CrossTalk to verify that it knows how to read the data properly. Currently this must be set to 3.0.

Assembly List Section

This section contains a list of assemblies to load. Classes listed in the next section must exist in assemblies listed here, otherwise CrossTalk cannot locate them. The only exception to this rule is mscorlib which is already loaded and contains many of the classes in the System.x namespace. string, and StringBuilder for example are in mscorlib.

Assemblies are listed one per line. There are two types of entries classified by their prefix of GAC: or USER:

If the prefix is GAC:, it must be followed by a fully qualified name (FQN) of an assembly in the GAC.

Example:

GAC:System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

For user assemblies the full path and name are specified instead.

Example:

USER:C:sourceCrossTalksourceCrossTalkRightTestbinDebugCrossTalkRightTest.dll

Class List Section

The class list lists classes that you wish to access from Delphi. They must be in assemblies listed in the assembly list, or mscorlib. Classes are listed one per line and must be fully qualified.

Example:

System.Xml.XmlReader

Note that .NET uses + for nested classes.

CrossTalkRightTest.DataSet1+CountryRow

Using the CTP File

Double click on the CTP file and associate it with CTClassGen.exe. This is the CrossTalk Class Generator. Currently it is a simple console application. It will output one .pas file per used .NET assembly. Each .pas file will have a CT prefix and be output in the same directory as the CTP file. Because of this, it makes sense to store the CTP file in the same directory as your Delphi project.

The generated .pas files are not designed to be modified by the developer. There should be no need to modify them anyways. If the .NET class that you are using changes, or you want to use more classes, just run the CTP file again and the generated .pas files will be overwritten with newer ones.