简体   繁体   English

不寻常的C函数声明

[英]Unusual C function declaration

I'm currently working with an old C library (made in the early 90's) and the following function declaration made me confused : 我目前正在使用旧的C库(在90年代早期制作),以下函数声明使我感到困惑:

#define bland_dll
typedef unsigned short int usint;
typedef unsigned char uchar;

int bland_dll Read_Chan (usint channel);

What is the bland_dll doing between the function's name and it's return type ? bland_dll在函数名和它的返回类型之间做了什么?

Thanks for your lights! 谢谢你的灯!

Its a macro defining empty, so when preprocessed it turns out to be: 它是一个宏定义为空,所以当预处理时它结果是:

int Read_Chan (usint channel);

I suspect, its a holdover from the early days when declaring DLL linkage types, like pascal which has a special meaning to the linker, for example. 我怀疑,它是从早期声明DLL链接类型的延续,例如pascal ,它对链接器有特殊意义。 Another example is __cdecl . 另一个例子是__cdecl

For completion of the idiosyncracies of compiler linkage mechanisms: 为了完成编译器链接机制的特性:

  1. __stdcall
  2. __fastcall
  3. __cdecl

Each of them influenced how the linker managed the name decoration at compile time, and may have caused conniptions with linking to third party DLL's due to the differing link time switches. 它们中的每一个都影响了链接器在编译时管理名称修饰的方式,并且可能由于链接时间开关的不同而导致链接到第三方DLL的连接。

Edit : Thanks unwind for the correction. 编辑 :谢谢放松修正。

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

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