Repost the dlltool and dllwrap tools for GCC

Source: Internet
Author: User
From: http://hi.baidu.com/oofy/blog/item/fa788a23ebdb4947ad34dede.html
I have never understood these two things. I spent some time today.

Summary:

There are two methods to create a DLL in mingw. One is to use gcc-shared...
The second is to use dllwrap...

Dllwrap is a set of tools called. GCC-shared is directly generated.

Dllwrap is more flexible, but gcc-shared is also enough.

Dlltool is a tool used to generate def, exp, and Lib files.
It can generate exp and Lib files based on the OBJ file (the base function is marked as _ declspec (dllexport) or def file.
The former (exp file, which contains the. edata segment) is used to create the DLL, and the latter (LIB file, which contains the. idata segment) is used to use the DLL

The dllname parameter in dlltool is only used to generate the library language name in the def file and the DLL name in the Lib file.
It does not need DLL information.

Several major references:
Creating a DLL using gcc-shared is also a good foundation for an experiment:

Http://www.adp-gmbh.ch/win/misc/mingw/dll.html

GNU-binutils manual, AS/AR/ranlib/dlltool/LD are all part of it
Gcc-shared parameters:

-- Add-stdcall-alias export symbols with and without @ NN
-- Kill-at remove @ NN from exported symbols
-- Out-implib <File> Generate import library
-- Output-Def <File> Generate a. Def file for the built DLL

Dlltool Parameters
-Z -- output-Def <deffile> name of. Def file to be created.
-- Export-all-Symbols export all symbols to. Def
-- No-export-all-symbols only export listed symbols
-- Exclude-Symbols <list> don't export <list>
-- No-default-excludes clear default exclude symbols
-B -- Base-file <basefile> Read linker generated base file.
-X -- no-idata4 don't generate idata $4 section.
-C -- no-idata5 don't generate idata $5 section.
-U -- add-underscore add underscores to symbols in interface library.
-K -- kill-at kill @ <n> from exported names.
-A -- add-stdcall-alias add aliases without @ <n>.
-P -- ext-Prefix-alias <prefix> Add aliases with <prefix>.

DLL called by _ stdcall generated in msvc and GCC

Http://www.geocities.com/yongweiwu/stdcall.htm

Also, you can experiment with yourself.

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.