Re: [Vala] C# conditional attributes in vala?



It is possible to define a macro in C, and crwate a vapi binding for
it, so that the C macro is treated as a method in Vala. It's a dirty
hack though.

You can see here how it's to be done:

http://gitorious.org/bnpe/bnpe/blobs/8eb4522f67948f02269359d706126a327869f18d/src/low_level_utils_test.h
http://gitorious.org/bnpe/bnpe/blobs/8eb4522f67948f02269359d706126a327869f18d/src/LowLevelUtils.vapi

(TRAP_MACRO and trapM method in Vala).

best regards,

Hi,

I have certain methods that I'd only like to be linked-in under certain circumstance (for performance 
reasons).  A real world example might be a need to log messages only from debug builds.

In C or C++, I could achieve this with a macro that would evaluate to a blank line when the appropriate flag 
is not set.

In C#, I could use conditional attributes to achieve the same result.

It's my understanding that there are no plans to ever add C style macros to Vala.  I was wondering if there 
were any plans to support C# conditional attributes in vala.  And if not, is there a way for me to advocate 
for the inclusion of Conditional Attributes into Vala?

In the mean time, it seems my only option is the rather inelegant solution of peppering my code with 
#if-#endif blocks.  If there is a vala solution, I am open to suggestions.

-Nigel
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list


-- 
Mój klucz publiczny o identyfikatorze 1024D/E12C5A4C znajduje się na
serwerze hkp://keys.gnupg.net

My public key with signature 1024D/E12C5A4C is on the server
hkp://keys.gnupg.net

Attachment: signature.asc
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]