none
How to hide a function or variable in C++/CX ? RRS feed

  • Question

  • Hi,

    I made a C++/CX runtime component for a C# UWP app. In C++/CX I have some global functions and variables, like this:

    #pragma once
    
    using namespace Platform;
    using namespace Windows::Foundation::Collections;
    
    namespace MySpace
    {
    	public ref class ErrorInfo sealed
    	{
    	internal:
    		// ...
    
    	public:
    		// ...
    	};
    }
    
    String^ CharToString(const char * text);
    String^ GetErrorMessage(UINT32 errorCode, String ^ defaultLocaleName);
    

    In Object Browser I can see the 2 functions and some global variables, that are in the cpp file. How can I hide this? Do I have to use an own ref class for these ones with the Windows::Foundation::Metadata::WebHostHidden Attribute or is there another way?

    Heiko

    Wednesday, August 15, 2018 5:29 PM

Answers

  • Hi,

    I'm not familiar with C++/CX coding so I'm not sure. If you want to hide the method, don't you need to defined it as private? 

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Heiko65456465 Thursday, August 16, 2018 9:43 AM
    Thursday, August 16, 2018 8:51 AM
    Moderator

All replies

  • Hi,

    I'm not familiar with C++/CX coding so I'm not sure. If you want to hide the method, don't you need to defined it as private? 

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Heiko65456465 Thursday, August 16, 2018 9:43 AM
    Thursday, August 16, 2018 8:51 AM
    Moderator
  • Thank you for your answer. The methds are global, means that they are not within a class, where I could make them private. If I try to make them private or internal the Compiler doesn't want it. But I will place them in a class, so I can make them internal.

    Heiko

    Thursday, August 16, 2018 9:41 AM