> cl func.cpp /LD
func.h
#include <stdio.h>
#define EXPORT
#ifdef EXPORT
#define DLL __declspec(dllexport)
#else
#define DLL __declspec(dllimport)
#endif
class DLL KONEKO
{
public:
int age;
char name[32];
KONEKO();
~KONEKO();
int func(int a);
};
func.cpp
#include "func.h"
KONEKO::KONEKO()
{
}
KONEKO::~KONEKO()
{
}
int KONEKO::func(int a)
{
return a + 100;
}
> cl main.cpp func.lib
main.cpp
#include <stdio.h>
#include "func.h"
int main(void)
{
KONEKO *kone = new KONEKO();
int a = kone->func(10);
printf("%d\n", a);
return 0;
}