Question

Here is the scenario:

I have WSCF Blue generated C# Web Service client that i have to call from C. I do it with C++ CLI "bridge". In C# web service client I have

namespace MyCompany.Product.ExternalPlan.Client
{
    public enum TMsgStatus
    {
        S_OK,
        //...
        E_ERROR,
    }

which is fine.

The C++ CLI project does something like this (this is not in any namespace!!):

try 
{
    EPClient::Client^ client = gcnew EPClient::Client();
    m_ResponseHeader = client->CreateExternalProject(n_Project->Id, m_ProjectData,     m_NameValuePairs,    // in 
                                    m_PlanAndWorksExternal, ConvertNativeToManaged(n_UserName),         // in 
                                    m_ProjectRet, m_PlanAndWorksRet);                                   // out
}
catch (Exception ^ e)
{
    // ...
    return -1;
}

if (m_ResponseHeader->Status == MyCompany::Product::ExternalPlan::Client::TMsgStatus::S_OK)
{
    ConvertManagedToNative(n_ProjectRet, m_ProjectRet);
} 

Now if I change S_OK in the if-statement above to E_ERROR it's OK. I read that in C++ enums are global so I think that's the reason it's mixed with this VS thing. I know almost nothing about C++ programming. C++ code is called from C and I have similar example that has no namespace. I don't think it even matters because i'm refering to S_OK with full namespace thing.

Thanks & Best Regards! -matti

Was it helpful?

Solution

I think it's more a problem of #define than namespaces. Try #undef S_OK before your code that uses it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top