1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#include <stdio.h>
#include <stdlib.h>
#include "..\DLL_test\dll.h"
extern __stdcall double add2num(double a, double b); /* DLL function add2num() */
int main(int argc, char *argv[])
{
double num1, num2, erg;
num1= num2= erg= 0,0;
printf("Put in two numbers, please. The numbers will be added\n");
printf("Number 1, please: ");
scanf("%lf", &num1);
printf("Number 2, please:");
scanf(" %lf", &num2);
/* 5. How do I call the DLL function double add2num(double, double); ? */
/* 5.1. I think there are two ways: static call or */
/* 5.5 dynamic call in the running programm, */
/* erg= add2num(num1, num2); <-- where has I to place __declspec (dllimport) ? */
erg= add2num(num1, num2);
printf(" %lf + %lf= %lf\n\n", num1, num2, erg);
system("PAUSE");
return 0;
}
|