如何把自己写的函数编译到动态库中

怎么把自己写的函数编译到动态库中
最近下载了X264最新的库,然后在 x264.h 文件中声明了一个自己的函数 void printVersion(); 然后在 x264.c 中将其实现了,然后用网上的编译方法生成了他的库和可执行程序。

运行可执行程序的时候自己写的函数已经生效了,但是我在VS下调用我自己写的函数时却报错:error LNK2001: 无法解析的外部符号 _printVersion

用VS的dumpbin命令查看列表中没有我自己定义的函数,请问这是为什么,怎样才能将我自定义的函数加到编译出来的库中?
------解决方案--------------------
__declspec(dllexport) extern "C"修饰要导出的函数

------解决方案--------------------
 
Export from a DLL Using .DEF Files
Home 
------解决方案--------------------
  Overview 
------解决方案--------------------
  How Do I 
------解决方案--------------------
  FAQ 
------解决方案--------------------
  Details 
------解决方案--------------------
  Sample

A module-definition (.DEF) file is a text file containing one or more module statements that describe various attributes of a DLL. If you are not using the __declspec(dllexport) keyword to export the DLL’s functions, then the DLL requires a .DEF file. 

A minimal .DEF file must contain the following module-definition statements: 

The first statement in the file must be the LIBRARY statement. This statement identifies the .DEF file as belonging to a DLL. The LIBRARY statement is followed by the name of the DLL. The linker places this name in the DLL's import library. 


The EXPORTS statement lists the names and, optionally, the ordinal values of the functions exported by the DLL. You assign the function an ordinal value by following the function’s name with an at sign (@) and a number. When you specify ordinal values, they must be in the range 1 through N, where N is the number of functions exported by the DLL. If you wish to export functions by ordinal, see Export Functions From a DLL By Ordinal Rather Than By Name as well as this topic.


Although not required, typically a .DEF file also contains a DESCRIPTION statement that describes the purpose of the DLL. 
For example, a DLL that contains the code to implement a binary search tree might look like the following:

LIBRARY   BTREE
DESCRIPTION "Implements a binary tree."
EXPORTS
   Insert   @1
   Delete   @2
   Member   @3
   Min   @4

If you use AppWizard to create an MFC DLL, AppWizard creates a skeleton .DEF file for you and automatically adds it to your project. Add the names of the functions to be exported to this file. For non-MFC DLLs, you must create the .DEF file yourself and add it to your project.

If you are exporting functions in a C++ file, you will have to either place the decorated names in the .DEF file or define your exported functions with standard C linkage by using extern “C”. If you need to place the decorated names in the .DEF file, you can obtain them by using the tool DUMPBIN or by using the linker switch /MAP. Note that the decorated names produced by the compiler are compiler specific. If you place the decorated names produced by the Visual C++ compiler into a .DEF file, applications that link to your DLL must also be built using the same version of Visual C++ so that the decorated names in the calling application match the exported names in the DLL’s .DEF file.

If you are building an extension DLL, and exporting using a .DEF file, place the following code at the beginning and end of your header files that contain the exported classes:

#undef AFX_DATA
#define AFX_DATA AFX_EXT_DATA