Sample CrossTalk Code

Sample CrossTalk Code

Here is a sample of what it looks like to use CrossTalk.

Source Code

This is Delphi 7 code running natively.

Output

Commentary

This is the complete program. It is a console application, but CrossTalk works with any Delphi application. StringBuilder in this code is not a Delphi equivalent class, it is actually Delphi code talking to StringBuilder in the .NET System.Text namespace.

The uses statement contains a reference to CT_System_Text. Adding this unit to the uses clause is equivalent to adding “using System.Text” in C#.

CT_System_Text.pas is a wrapper generated by the CrossTalk wizard. The wizard is used to select which .NET assemblies and classes that you wish to use. No changes are needed to the .NET code. Using .NET from CrossTalk is similar to using COM object except that unlike COM, CrossTalk will not leave you with a bunch of nasty TLB imports that you need to manually fix up. You can rerun the wizard as many times as you like to add more classes, or adjust for interface changes in the .NET code.

In this demo a system class was used. However CrossTalk will support any .NET class, not just ones that are part of the .NET framework. So CrossTalk can be used to connect to classes you have written in .NET or third party libraries.

Deployment

There are no registry entries required, and no COM is used so there are no COM DLLs to be registered.

Simply deploy your application plus two DLLs. These DLLs can be put in the application directory for easy deployment.