Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
4 ratings:
 4.5 out of 5     Rate this Document

Using the __FUNCTION__ Macro in LabWindows/CVI 8.5

Primary Software: LabWindows/CVI Development Systems>>Full Development System
Primary Software Version: 8.5
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I just installed LabWindows/CVI 8.5 and tried to compile one of our projects that uses the __FUNCTION__ macro. However, the compiler throws an error when I attempt to use that macro. This macro worked in LabWindows/CVI 8.1.1. How do I use the __FUNCTION__ macro in LabWindows/CVI 8.5?

Solution:
The __FUNCTION__ macro is part of the C99 standard and not part of the ANSI C 89 standard which is what LabWindows/CVI is currently based on. What happened in LabWindows/CVI 8.5 was that a handful of the features that comprise the C99 standard were added. Because code that uses C99 features might not be compatible with other C compilers, in order to use any of the C99-specific features of LabWindows/CVI 8.5, you will have to add a new pragma to your code:

#pragma iso_9899_1999

Since __FUNCTION__ is really a C99 feature, it is now also grouped with the other features that require the use of this pragma. Actually, to be more precise, the C99 standard calls for "__func__", not "__FUNCTION__". However, both should work in LabWindows/CVI 8.5.

So in order to continue using __FUNCTION__, you must have a line with the pragma mentioned somewhere above the use of the macro.

Note LabWindows/CVI 8.5 is still not C99-compatible.

Related Links:

Attachments:





Report Date: 11/26/2007
Last Updated: 11/26/2007
Document ID: 4FPAOI6S

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit