Create a dynamic library step by step

Source: Internet
Author: User

First step: Open VS2010

Step Two: Use the wizard to create a WIN32 console program. Note Select the DLL and the empty program.

Step Three: Use the wizard to add a file named Mian.c to the source file.

Fourth step: Add code.

#include <windows.h>//add a header file or the compiler doesn't know what your int is. variable of type int_declspec (dllexport)//The point here _declspec is that Microsoft's proprietary modifier is for the compiler to see. _declspec is a very large concept. PlusDoubleIn1,DoubleIn2,Double* out){    * out= in1+in2; return 0;}/*dllimport,dllexport: Format: __declspec (dllimport) declarator__declspec (dllexport) declarator is used to import functions from DLLs, data, or objects as well as exported functions, data, or objects from the DLL. Equivalent to the interface that defines the DLL, defines the functions, data, or objects that can be used for its client EXE or DLL. Declaring a function as dllexport eliminates the definition of the module definition (. DEF) file. Dllexport replaced the __export keyword. The function names that are exported by C + + functions declared as dllexport are processed according to C + + rules. If you require name processing that does not follow C + + rules, use a. def file or use extern "C". */

Fifth Step: Compiling

Connection

Create a dynamic library step-by-step

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.