/cpp/dll/fun.cpp
#include "fun.h" int fun(int n) { if (n < 1) return 1; return n * fun(n - 1); }
/cpp/dll/fun.h
#ifndef FUN_H #define FUN_H int fun(int n); #endif // FUN_H
/cpp/dll/main.cpp
#include <iostream> using namespace std; #include "fun.h" int main() { cout << fun(5) << endl; }
/cpp/dll/Makefile
main: g++ -c fun.cpp main.cpp g++ -shared fun.o -o fun.dll g++ main.o -I. -L. -lfun -o main.exe strip fun.dll main.exe clean: del *.bak *.o *.dll *.exe