Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 885
Exho Avatar asked May 20 '16 09:05

Exho


1 Answers

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.

like image 99
t0mm13b Avatar answered Sep 28 '22 04:09

t0mm13b