ADS-OCX limitations in Delphi applications

Delphi's Memory Manager

In the AdsOcx application you have to make sure that the system variable: IsMultiThread is set to True in any case. The Memory Manager is "thread-safe" only if this variable is set. Only then will access to shared resources be locked. Often the Memory Manager of Delphi does not set this variable if an included DLL or control starts own threads.

Add the following line to the initialization section of your application:

Initialization
    IsMultiThread := True;// Setting this system variable makes Delphi's memory manager thread-safe

Methods/properties

The following properties, methods and events cause errors in Delphi applications, and must not be used. As can be seen in the table, either the latest version of Delphi should be used, or certain functionalities must be omitted. There are a variety of a updates for the Delphi versions listed, and these may correct certain errors. 

 

Error description

Workaround

Delphi version

Properties

 

 

3.0

4.0

5.0

6.0

AdsClientType

There is a memory leak when accessing this property. Memory for the returned string is not returned correctly. 

n/a

Bug

?

Fixed

 

AdsClientAdsState

There is a memory leak when accessing this property. Memory for the returned string is not returned correctly. 

n/a

Bug

?

Fixed

 

AdsClientAdsControl

There is a memory leak when accessing this property. Memory for the returned string is not returned correctly. 

n/a

Bug

?

Fixed

 

AdsServerAdsControl

There is a memory leak when accessing this property. Memory for the returned string is not returned correctly. 

n/a

Bug

?

Fixed

 

AdsServerAdsState

There is a memory leak when accessing this property. Memory for the returned string is not returned correctly. 

n/a

Bug

?

Fixed

 

AdsServerType

There is a memory leak when accessing this property. Memory for the returned string is not returned correctly. 

n/a

Bug

?

Fixed

 

AdsServerLastMessage

There is a memory leak when accessing this property. Memory for the returned string is not returned correctly. 

n/a

Bug

?

Fixed

 

AdsAmsClientNetId

There is a memory leak when accessing this property. Memory for the returned string is not returned correctly. 

n/a

Bug

?

Fixed

 

AdsAmsServerNetId

There is a memory leak when accessing this property. Memory for the returned string is not returned correctly. 

n/a

Bug

?

Fixed

 

Methods

 

 

 

 

 

 

All methods

The functions of the generated type library ADSOCXLib_TLB return undefined return parameters.

Please install the Delphi 6 Update Pack 2 and rebind the ADSOCX.

-

-

no bug

Bug

AdsSyncReadReq

AdsSyncWriteReq

These methods allow variables of any type to be transferred to the PLC or to be read from the PLC. The OleVariant parameters, however, are passed by value and not by reference by the AdsSyncReadReq method. This means that the method cannot alter the value of the data parameter during the call. Although it is true that the PLC variables are copied into a corresponding OleVariant variable during the call, that variable is only a copy of the actual variable from the current parameter list. The method prototypes for the ADS-OCX are generated automatically by the Delphi development environment when the ADS-OCX is linked, and cannot be modified.

Use the "released" methods to have synchronous access the PLC variables (e.g.

AdsSyncReadIntegerReq() etc. ). 

Bug

?

Bug

 

AdsReadVarConnectEx

Similarly to the process for the AdsSync methods, the OleVariant parameters in the event functions are passed by value and not by reference.

Use the AdsReadVarConnectEx2 method

Bug

?

Bug

 

Events

 

 

 

 

 

 

AdsReadConnectUpdateEx

An access violation is generated when the event function is called.

Use the AdsReadConnectUpdateEx2 event function

Bug

?

Bug