Hey folks,
i have issues calling 2 dlls (DLL1 + DLL2) from another DLL (EXPORT).
The situation is:
The main DLL "Export" calls 2 other DLLs within its function.
You can set a communication interval for the main DLL (e.g. 0.01s)
but the 2 DLLs to be called should not be called at the same rate.
(e.g. DLL1 should be called at 0.01s, like the main dll, but the DLL2 should be called at 0.1 s)
The Code (only necessary parts without time-shift) looks like this:
Code:
#include <stdio.h>
#include <string.h>
#include <windows.h>
#define _USE_MATH_DEFINES
#include <math.h>
typedef void (_cdecl *CTRL)(double*, double*);
typedef void (_cdecl *INIT)(double*, double*);
double inputarray1[101];
double inputarray2[101];
double outputarray1[101];
double outputarray2[101];
int counter;
extern "C"
{void __declspec(dllexport) __cdecl EXPORT(float *var1,int *var2, char *var3, char *var4, char *var5);}
void __declspec(dllexport) __cdecl EXPORT(float *var1,int *var2, char *var3, char *var4, char *var5)
{
HINSTANCE hinstlib_dll1= LoadLibrary(L"dll1.dll");
HINSTANCE hinstlib_dll2= LoadLibrary(L"dll2.dll");
call_dll1=(CTRL)GetProcAddress(hinstlib_dll1l,"CONTROL");
call_dll1(inputarray1, outputarray1); <--- Function CONTROL in DLL1 should be called at 0.01s rate
call_dll2=(CTRL)GetProcAddress(hinstlib_dll2l,"CONTROL");
call_dll2(inputarray2, outputarray2); <--- Function CONTROL in DLL2 should be called at 0.1s rate
}
So I think the best would be to set the communication interval to 0.01s to fulfill the calling convention for DLL1 and using a counter the calls the DLL2 every 10 counts (to fulfill 0.1s calling convention).
Can you guys help me out?