DLL function: Calling own functions from DLL

This command allows calling own functions for the generation of new elements. 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 Interface 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

All functions must have the following prototype:

typedef struct


            int ne;               // number of elements

            int  nn1;                       // array length of one element

            int npv;             // number of nodes

            int **nel;          // elements: nel[nev+1][nn1]

            float (*pkt)[3]; // node coordinates

} festruct;


extern “C”

void function (CWnd *pWnd, festruct *in, festruct *out, int kfree, int kzf, void *p);


pWnd is a pointer to the protocol window of MAKROS. If the function uses dialogs, pWnd should be used as the parent window.

in is a pointer to a structure that contains the elements and the nodes of the active element structure. For each element following data is given: external element ID, type ID of the element, mechanical type ID, group ID and indices of the element nodes. Elements and nodes are stored beginning with index 1.

out is a pointer to a structure, that can be used to give new elements and nodes back to MAKROS. New elements are added to existing elements.

kfree is a parameter. The function is invoked twice, the first time kfree has the value 0, in this case new elements can be returned to MAKROS. After these elements have been added to the structure, the function is called again with kfree = 1, in this case only the allocated memory for the new elements should be freed.

kzf is the ID of the function type and must be 0 with this type.

p is a pointer to a structure and is not used with this type of functions.