简体   繁体   中英

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 :

#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 ?

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. Another example is __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.

Edit : Thanks unwind for the correction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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