create a dll project
dll.h:
Code:
#ifndef _MY_DLL_
#define _MY_DLL_
#ifdef _IMPORTING_
#define _DLLAPIMAIN_ __declspec(dllimport)
#else
#define _DLLAPIMAIN_ __declspec(dllexport)
#endif
_DLLAPIMAIN_ int multiply(int a, int b);
#endif
dll.c
Code:
#include "dll.h"
int multiply(int a, int b)
{
return a * b;
}
compile:
create a normal project
copy the dll.dll, dll.lib , and dll.h file to the new project directory
main.c
Code:
#include <stdio.h>
#define _IMPORTING_
#include <dll.h>
int main()
{
printf("1 * 3 = %d",multiply(1,3));
return 0;
}
thats all there is to it.