14 Integrating C Functions (DLL)
Example:
Subprogram: | DLL: |
---|---|
LOAD SUB "SUBPG" | LOAD DLL Subpg, 1024 |
CALL Numeric(A$,A) | CALL DLL Subpg("Numeric", A$,A) |
DEL SUB Numeric TO END | DEL DLL Subpg |
The following table illustrates the differences and similarities between a subprogram and a DLL.
Subprogram | DLL | |
---|---|---|
Programming Language: | Eloquence | C |
Procedures | Yes | Yes |
Functions | Yes | No |
COM variables | Yes | No |
Module-specific variables | No | Yes |
File arguments | Yes | No |
Variable arguments | No | Yes |
Call to Eloquence | Yes | No |
Input/Output to screen | Yes | No |
The DLL is started from within Eloquence as a separate process.
Communication between Eloquence and the DLL process is realized using shared memory, which is a storage area that can be accessed simultaneously by several processes.
LOAD DLL starts the DLL process and initializes the shared memory. The DLL process now waits for a signal from Eloquence.
CALL DLL copies the arguments into shared memory and signals the DLL process that the arguments have been passed. Now control is passed to the DLL.
After the DLL process has finished processing, control is passed back to Eloquence.
DEL DLL terminates the DLL process and releases the shared memory.
The syntax is as follows:
LOAD DLL Name [,filename$], size
LOAD DLL Sample, 512 LOAD DLL Test, "TEST,SYSTEM", 1024The first example starts the DLL /opt/eloquence/dll/Sample and creates a shared memory of 512 Bytes.
The second example starts the DLL Test, which is located in the file TEST in the directory specified by the volume name SYSTEM and creates a shared memory of 1024 Bytes.
A maximum of five DLL processes can be loaded.
Possible Error Messages:
The syntax is as follows:
DEL DLL Name
DEL DLL SampleThis terminates the DLL loaded with the name Sample.
The syntax is as follows:
CALL DLL Name( Proc$ [,arguments])
CALL DLL Sample(P$,A$) CALL DLL Test("check", 1,"TEST",A$,A$(*),I,I(*))The first example calls the procedure whose name is stored in P$ in the DLL Sample using the argument A$. The second example calls the procedure check of the DLL Test with the arguments 1, "TEST", A$, A$(*), I,I(*).
Possible Error Messages:
The size of the area depends on the number and type of the arguments:
36 Bytes + 24 Bytes per argument.
Additional requirements per argument: