I have a function defined in the Header of my .dll
void calculo(vector<double> A, vector<int> B, double &Ans1, double jj);
in the .cpp file it is defined as follows:
void calculo(vector<double> A, vector<int> B, double &Ans1, double jj = 36.5);
I am calling this .dll from another c++ code using the following code:
#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <stdio.h>
#include "TEST_DLL.h"
typedef void(_stdcall *f_funci)(vector<double> A, vector<int> B, double &Ans1, double jj);
int main()
{
vector<double> A;
vector<int> B;
double ans1;
double teste;
HINSTANCE hGetProcIDDLL = LoadLibrary(L"MINHA_DLL.dll");
if (!hGetProcIDDLL) {
std::cout << "could not load the dynamic library" << std::endl;
return EXIT_FAILURE;
}
f_funci Resultado = (f_funci)GetProcAddress(hGetProcIDDLL, "calculo");
if (!Resultado) {
std::cout << "could not locate the function" << std::endl;
return EXIT_FAILURE;
}
Resultado(A,B, ans1, teste);
}
This way the function works if I input the "jj"
parameter. However as it is defined as an standard input in the .dll it should work also without it but if I try it do not compile. Is there a way that I could declare in the procedure of loading the function from the .dll that the "jj"
parameter have a standard input value?
trying to compile using Resultado(A,B, ans1);
generates the following error:
error C2198: 'f_funci': too few arguments for call