#ifndef _TEST_DLL_H
#define _TEST_DLL_H
#ifdef __cplusplus
extern "C" { /* C style */
#endif
#ifdef _DLL /* DLL, defined when /MD(d) flag is specified */
# ifdef TESTDLL_EXPORTS /* export */
# define TEST_DLLPORT __declspec(dllexport)
# else /* import */
# define TEST_DLLPORT __declspec(dllimport)
# endif
#else /* LIB */
# define TEST_DLLPORT
#endif
/* function foo() */
TEST_DLLPORT void foo();
#ifdef __cplusplus
}
#endif
#endif
注意, dllexport/dllimport必须成对出现. dllexport会把生成的import library的入口统一加上__imp_的prefix, 而dllimport则会找对应的这个prefix来完成link. 所以, 如果用static library的static library加dllimport的文件是会link error找不到符号的.



