-
February 16th, 2021, 04:27 AM
#1
__attribute__ ??
I'm building a project here which used to build fine with VS2008. There's one function which looks like this:-
Code:
__attribute__((constructor))
static void init_weak_jack(void)
{
// rest of function
}
but VS2019 doesn't understand the __attribute__ keyword. I can't see it defined in the project's header files so I'm assuming it used to be a VS2008 keyword. Is it something that's maybe deprecated now?
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
February 16th, 2021, 05:44 AM
#2
Re: __attribute__ ??
Hi John, as far as I could find here:
__attribute__ is not a macro, it is a GCC specific extension that needs to be replaced with appropriate equivalent Visual C++ has. Its equivalent is usually __declspec
Also have a look at
https://social.msdn.microsoft.com/Fo...orum=vcgeneral
Victor Nijegorodov
-
February 16th, 2021, 07:55 AM
#3
Re: __attribute__ ??
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
February 16th, 2021, 09:31 AM
#4
Re: __attribute__ ??
Thanks guys. For the moment I've just commented the line out - and AFAICT it isn't causing any problems
"A problem well stated is a problem half solved.” - Charles F. Kettering
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
|