Interface (DLL): Calling own interface functions from a DLL
This command allows calling own interface functions. The functions must
be provided in one or more DLL files.
Following dialog shows the available options:
DLL file
Load new DLL: Clicking this button, a file selection box pops up, where the file of
the DLL to be loaded must be selected.
Delete DLL:
All loaded DLLs are show in the list box. After selecting a DLL it can be
deleted by clicking the button.
DLL
function
Call function: A function name must be given in the input field. Clicking the button,
this function will be called. If the function is called the first time, the
name of the DLL where the file is contained in must also be selected in the
list of DLL names.
The list
shows all the functions that have previously called; these functions can be
called several times.
When the command is invoked the first time, it
is checked, whether there exists a file „maka_interface.ini“ in the “bin”
folder of MAKROS that contains some lines of following type:
#dll kf
function path
„kf“ is the type ID of the function, „function“
is the function name of an exported function in the DLL and path is the path of
the DLL, the function is contained in.
For
example:
#dll 0
funct1 G:\boege\makrosa\testdll\dll1\debug\dll1.dll
#dll 0
funct2 G:\boege\makrosa\testdll\dllmfc\debug\dllmfc.dll
#dll 1
testInterface G:\boege\makrosa\testdll\interf\debug\interface.dll
If lines of this type are found, the DLLs are
automatically loaded and the entry points of the functions are searched and
stored. The DLL and function names are shown in the list boxes of the dialog
window.
Prototype
of functions
Functions of this type (type ID 1) must have
the following prototype:
extern
"C"
void
Interface(void *pCWnd, StructData *data, char *file,
int kz, int kzf,
void *p);
The arguments have the following meaning:
pWnd: pointer to the protocol window of MAKROS,
this window should be used as parent, if dialog windows are used in the
function,
data: Pointer to a structure, that contains all
project data that is needed for the interface file. The structure “StructData”
is fully described in the file "interface.h“,
file: title of the file to be created,
kz: not used with this kind of functions,
kzf: ID of the file type, must be 1 with this type
of functions,
p: pointer to a structure not used with this
type of function.
If a function of this type is called, first it
is asked, whether all data is saved to disk, because the data that is supplied
to the function is read from the binary files of the current project. Then the
file title to be used for the interface file must be given in a file selection
window, this file title is used as parameter 3 of the function.
A template DLL of this type is contained in the
folder dll/interface on the CD.