example: ------------------------------------------------- main.cpp #include <stdio.h> #include <windows.h> extern "C" __declspec(dllimport) void xxx(char *str, ...); extern "C" __declspec(dllimport) char *zzz; int WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR szCmdLine, int) { xxx("blahblah\n", 1, 2, 3); printf(zzz); return 0; } --------------------------------------------------- mylib.cpp #include <stdio.h> #include <windows.h> extern "C" __declspec(dllexport) void xxx(char *str, ...); char zzz[80]; void xxx(char *str, ...) { printf(str); lstrcpy(zzz, "12345\n"); printf(zzz); } ---------------------------------------------------- mylib.dll.spec @ varargs xxx(str) @ extern zzz ----------------------------------------------------- mylib.cpp compiled successfully in mylib.dll.so main.cpp compiler error: undefined reference to `zzz' What I do wrong ??? How to export variables ??? And another question: how can i export functions such as ClassName::Function();