0

i have these GNU macro:

#if defined __GNUC__
    #define EVENT [[gnu::weak]]
#elif defined __clang__
    #define EVENT [[llvm::weak]]
#endif
#define IS_EVENT_DEFINED(sym) (static_cast<bool>(sym))

these macro works fine. and help me test if the function(even with a prototype) was defined.
my problem is can i convert

[[gnu::weak]]

to Visual Studio code(for be compatible)?
because the Visual Studio don't have 'weak'

2
Contributors
5
Replies
18
Views
2 Months
Discussion Span
Last Post by rproffitt
0

I read https://social.msdn.microsoft.com/Forums/vstudio/en-US/645d3065-85db-4ebf-ac20-70325dcc9318/c-how-use-weak-macro?forum=vclanguage and feel that you received some excellent replies there. I do get the feeling you want GCC in Visual Studio without any work. I could be wrong but that's the feeling I got from reading that long discussion.

That said the most often this sort of thing comes up is someone is just wanting to use GCC code without a re-write. Sometimes it's unavoidable.

Here's what is likely going on:

This is something that doesn't work in the same way in Windows

So it's a PITR.

0

to be honest i don't get what i need.
i have 1 code for detect if the class have a function(even if is a prototype), but no for test if the function is defined :(
these macro help me do that, but isn't compatible with Visual Studio.
so let me ask you: how can i test if the function was defined?

0

i'm sorry, but do youy know how works 'weak' for, maybe, i create my own?
(the virtual functions from base class, on child\derived class, must have a prototype for i define them outside the class... i hate these rule :( )

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.