-
October 28th, 2018, 04:22 PM
#1
__declspec: Can be compiled on GNU compilers?
Will the code below be able to be compiled on GNU compilers if the user defines DLL_IMPORT or DLL_EXPORT? Or gcc/g++ will complain about the __declspec?
Code:
#ifndef TEST_H
#define TEST_H
//Use this header for end user.
#ifdef DLL_IMPORT
# define DLL_MACRO __declspec(dllimport)
//Use this header for building the dll.
#elif defined DLL_EXPORT
# define DLL_MACRO __declspec(dllexport)
#else
# define DLL_MACRO
#endif
DLL_MACRO void print(const char *message);
#endif
-
October 28th, 2018, 04:42 PM
#2
Re: __declspec: Can be compiled on GNU compilers?
-
October 28th, 2018, 05:19 PM
#3
Re: __declspec: Can be compiled on GNU compilers?
Originally Posted by Arjay
So, it's Microsoft specific modifiers. I thought I saw somewhere that GNU actually supports specifically the __declspec, this is why i asked you.
So in other words, when I'm building dll libraries I should use macros like the ones in my first post in order to control what code will get compiled for each platform, right? 99% I program in windows and visual studio but most of the times I want my code to be cross-compile able.
-
October 28th, 2018, 05:47 PM
#4
Re: __declspec: Can be compiled on GNU compilers?
How about googling for "is __declspec supported in gnu"?
-
October 28th, 2018, 05:51 PM
#5
Re: __declspec: Can be compiled on GNU compilers?
Originally Posted by Arjay
How about googling for "is __declspec supported in gnu"?
I did before asking, but the answers wasn't clear.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|