在GCC或G ++(Linux)中使用__declspec() [英] Use of __declspec() in GCC or G++ (Linux)

查看:99
本文介绍了在GCC或G ++(Linux)中使用__declspec()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在GCC编译器中__declspec()的用途是什么?通过一些研究,我发现它是Microsoft专有的扩展,用于访问共享的.dll库.那么,它在Linux(或像mqx这样的Rots)中有什么用?这是我发现的一部分示例代码,将使用GCC进行编译.

What is the use of __declspec() in GCC compilers? From some research i found that it is a Microsoft specific extension to access shared .dll libraries. So what is it's use in Linux(or Rots like mqx)? This is a piece of sample code that i found which is to be compiled with GCC.

__declspec(section "configROM")

推荐答案

我想像的是,运行某些晦涩的 WindowsX/ARM 系统的 ARM 也需要您的 __ declspec ;相反,您的 __ declspec 在Linux/x86上毫无意义.

What I would imagine that an ARM running some obscure WindowsX/ARM system would also need your __declspec; conversely, your __declspec has no sense on Linux/x86.

AFAIK,

__attribute__((visibility("default")))

据我所知,在Linux中没有等效的 __ declspec(dllimport).

And there is no equivalent of __declspec(dllimport) in linux to my knowledge.

在cygwin,mingw和arm-pe目标上,__declspec(dllimport)是公认是__attribute__((dllimport))的同义词与其他Microsoft Windows编译器兼容.

On cygwin, mingw and arm-pe targets, __declspec(dllimport) is recognized as a synonym for __attribute__ ((dllimport)) for compatibility with other Microsoft Windows compilers.

请查看来自GCC的可见性支持, https://gcc.gnu.org/wiki/可见性

Have a look at this visibility support from GCC, https://gcc.gnu.org/wiki/Visibility

这篇关于在GCC或G ++(Linux)中使用__declspec()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆