//Test For DLLs #include /* Use this command to run gcc -shared 3.c -o calc.dll -Wl,--out-implib,libcalc.a */ #ifndef BUILD_DLL #define API __declspec(dllexport) #else #define API __declspec(dllimport) #endif API int add(int a, int b){ return a + b; } API int mul(int a, int b){ return a * b; } API int sub(int a, int b){ return a - b; } API int divd(int a, int b){ if(b == 0) return -1; return a / b; } API int calc(int a, int b, char op){ switch(op){ case '+': return add(a, b); case '-': return sub(a, b); case '*': return mul(a, b); case '/': return divd(a, b); } }