Helpful Tips for Using the DLL Function

by Mehmet Okonsar

Aug 3, 1999

 

CAL's DLL call.

General : The experiments were done with CW ver.8 and Delphi3.

 

 1) Data Types:

INTEGERS : Data sent by CAL as type "integer" must be declared as byte, word, smallint, longint, etc in the DLL code. Random data is received if the DLL declares integer also .

STRING : Any strings must be declared as null terminated "char" arrays in the DLL

2) Parameters:

One can send 2 parameters at most when calling a service in a DLL. The third parameter, if any, does not generated an error but random data is sent.

3) Memory Management:

As far as I know there is no way to make the call to DLL "persistent" or "static", even though the DLL is called by CWPA.EXE (not the CAL program), the DLL as removed from memory as soon as the corresponding line in the CAL code has been processed. This is because CAL is interpreted and not compiled, and it does not provide the possibility to make a persistent call to a DLL. This fact, combined with CAL's own limitations, makes it impossible to send a bunch of data to the DLL all at once. If the DLL is to be used to write to a file, cwpa.exe keeps "hands" on the file which can be opened, written to and closed only once and then cannot be reopened again without closing cwpa.exe altogether. There is no problem calling the DLL from within a loop, though this is somewhat slow.

4) Miscellaneous:

The arguments for the call to a DLL must include the full path name even if the CAL file making the call is in the same directory with the DLL. This path can be either a long name or a "eight-point-three" DOS type path names. It seems they both work. For "safety reasons" I kept with the DOS type definitions.

 

returner.gif (1353 bytes)Return To Updates Page

 

returner.gif (1353 bytes)Return To Home Page