[英]Windows C++ Eclipse MinGW link both dynamic and static library
I am new to C++ programming. 我是C ++编程的新手。 There are 2 libraries in my program, one needs to be linked dynamically, and the other needs to be linked statically, how can I set this up in Eclipse?
我的程序中有2个库,一个需要动态链接,而另一个则需要静态链接,如何在Eclipse中进行设置? I am using Eclipse CDT + MinGW + Windows 7.
我正在使用Eclipse CDT + MinGW + Windows 7。
Thanks. 谢谢。
It's not entirely clear what you're after here. 目前尚不清楚您在这里追求什么。
Most of static vs. dynamic is in the library itself, not how you link to it. 静态与动态的大部分都在库本身中,而不是您如何链接到它。 You can have a static library, which is basically just a collection of object files, stuffed together into a single file, with a directory to tell what parts were originally which files.
您可以拥有一个静态库,该库基本上只是对象文件的集合,并塞入一个文件中,并带有一个目录,以告知最初哪些部分是哪些文件。
You can also have a DLL. 您也可以有一个DLL。 When you create a DLL, the linker will normally also create a link library for that DLL.
当您创建DLL时,链接程序通常还会为该DLL创建一个链接库。 This library basically just contains stubs -- enough information so the linker can insert a link to the DLL into another DLL or executable.
该库基本上只包含存根-足够的信息,因此链接程序可以将DLL的链接插入另一个DLL或可执行文件。
When you use a DLL, you basically have three options for how to use it: 使用DLL时,基本上有三种使用方式的选择:
LoadLibrary
and GetProcAddress
to load the library, and get a callable function address. LoadLibrary
和GetProcAddress
加载库,并获取可调用的函数地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.