Migrate from 32bit to 64bit [3]

Source: Internet
Author: User

> *. Lib files cannot be generated.

Symptom:

The *. Lib file is not generated for a newly generated DLL.

Solution:

The reason is that no symbol is exported. either explicitly specify a *. Def file or "_ declspec (dllexport)" is required )"

Therefore, smcp_dll or *. Def file is required.

-----------------------------------------------------------------

# Ifdef smcp_dll
# Ifdef smcpdecl_app_qtwidgets
# Define export_app_qtwidgets _ declspec (dllexport)
# Else
# Define export_app_qtwidgets _ declspec (dllimport)
# Endif
# Else
# Define export_app_qtwidgets
# Endif

-----------------------------------------------------------------

In the linker-> advanced property Tab Of the DLL project, verify that the value for import library (. lib file you are looking for) is correct/reasonable. the value of this property will determine what the import library is named, and where the linker will write it.

You may also need to generate an imports definition file (. def) in your project, or check your header files and make sure your exported functions are tagged with the _ declspec (dllexport) qualifier in the header file. this is usually toggled by a # define such:

#ifdef MYAPI_EXPORTS #define MYAPI_API __declspec(dllexport) #else #define MYAPI_API __declspec(dllimport) #endif void MYAPI_API foo(int bar); 

Basically you want the compiler to see dllexport when it is building the library, but dllimport when your client code is # including the header file. if Visual Studio generated the basic project structure, it probably already created a suitable # define to use.

You do not have to both create the. Def file and add the dllexport, just one or the other.I prefer the latter. Also, if you choose to use a. Def file, you need to specify it in the linker PROPERTIES OF YOUR library project.

> Targe machine shocould be changed

Set "target machine": machinex64 (/machine: x64)

 

> Materials

Optimization of 64 bit programs

Http://www.codeproject.com/Articles/33565/Optimization-of-64-bit-programs

20 issues of porting C ++ code on the 64-bit Platform

Http://www.codeproject.com/Articles/18855/20-issues-of-porting-C-code-on-the-64-bit-platform

Lessons on development of 64-bit C/C ++ applications

Http://www.codeproject.com/Articles/359970/Lessons-on-development-of-64-bit-C-Cplusplus-appli

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.