Jump to content

Multiple Return Types in C++ Functions?

- - - - -

  • Please log in to reply
2 replies to this topic

#1
shezarkh

shezarkh

    Newbie

  • Members
  • Pip
  • 2 posts
Hello

I have a header file with absolutely no comments in it. I was reading through it and I came across this function prototype:

  E_DLL0 void E_DLL1 StartSaving(const char* pszFileName, HWND hwndDialogParent = E_INVALID_HWND);


I was wondering if anybody knows why this function seems to have 3 return types: E_DLL0 and void, and E_DLL1

Thank you

#2
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,254 posts
  • Location:C:\Countries\US
I don't think that's possible. Not that I know of, anyway.

I mean, I tried 'int float multiple_return();' in a .cpp file and my compiler complained about invalid combination of types.

Then I tried 'int multiple_return();' and then 'float multiple_return();' but the compiler complained again, saying that that name was previously declared as something else.

So maybe E_DLL0 and E_DLL1 mean something else?

#3
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts
I found this exact line of code in the Euresys eVision source code, in particular in EAVI.h. E_DLL0 and E_DLL1 are two macros made with #define, and they expand to different things depending on the compiler. You'll need to look at Easy.h and check the definition for your compiler to determine what those actually are. For example, in the case of GCC:
#elif defined __GNUC__

  #define E_COMPILER "GNU C under Linux"
  #define E_GCC
  #define E_COMPILER_SHORT_STRING   "Gcc"
  #define E_DLL0
  #define E_DLL1


  #define E_STDCALL 
  #define E_CDECL 


//-----------------------------------------------------------------------------
E_DLL0 and E_DLL1 expand to nothing. Some compilers use special flags or annotations when linking to DLL's or other shared object files, for example Microsoft has the _declspec() thing...
  #if defined E_STATIC
    #define E_DLL0
  #elif defined E_DLL_EXPORT
    #define E_DLL0 _declspec( dllexport)
  #else
    #define E_DLL0 _declspec( dllimport)
  #endif
  #define E_DLL1

Wow I changed my sig!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users