简体   繁体   English

可执行文件与可加载模块之间的可移植性如何?

[英]How portable is linking executables against loadable modules?

I have a project on my hand with some libraries that are compiled as loadable modules, ie linked with libtool's -module flag. 我手上有一个项目,其中一些库被编译为可加载模块,即与libtool的-module标志链接。 These libraries are supposed to contain all the necessary functions in themselves or their dependencies, that is, they should yield a complete program when linked with a simple main() function that simply calls all functions of the module interface for my program. 这些库本身应该包含所有必需的函数或它们的依赖项,也就是说,当它们与一个简单的main()函数链接时它们应该产生一个完整的程序,该函数简单地为我的程序调用模块接口的所有函数。

Since I had issues with incomplete and thus unusable modules before, I have a few simple check programs that do just contain a main() and are linked against the modules. 由于之前我遇到过不完整且因此无法使用的模块的问题,我有一些简单的检查程序,它们只包含一个main()并且与模块相关联。 When a function is missing, the linker croaks with appropriate warnings, so all good there. 当一个函数丢失时,链接器会发出适当的警告,所以那里都很好。 However, libtool gives me one warning: 但是,libtool给了我一个警告:

*** Warning: Linking the executable checkplugin_locprec against the loadable module
*** liblocprec.so is not portable!

I understand the purpose and intent of this warning (don't link a program against a library built with -module ), however not its severity, and that's my question: 我理解这个警告的目的和意图(不要将程序与使用-module构建的库链接),但不是它的严重性,这是我的问题:

How severe is this warning? 这警告有多严重? Am I just lucky that this works on the platforms I am compiling for (i386/x86_64 Linux and MinGW) or is this warning just relevant for some obscure backwood platform I can safely ignore? 我很幸运,这适用于我正在编译的平台(i386 / x86_64 Linux和MinGW),或者这个警告是否与我可以放心忽略的一些不起眼的软件平台相关?

The main platform were this doesn't work is Mac OS X. On other platforms, it should generally work, but might fail depending on other build options you use. 主要平台是不起作用的是Mac OS X.在其他平台上,它通常应该可以工作,但可能会失败,具体取决于您使用的其他构建选项。 If you used libtool, then you are probably safe on other platforms. 如果您使用了libtool,那么您在其他平台上可能是安全的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM