views:

377

answers:

2

I've got a static method, MyClass::myMethod() on another DLL, MyDll.dll. In my code, I call this method, and it compiles and run fine.

But when I try MyClass::myMethod() in the immediate window (or the watch window), I always get:

MyClass::myMethod()
CXX0052: Error: member function not present

Why is that?

Update: I've found out that when I use the context operator it works:

{,,MyDLL}MyClass::myMethod()

I'm not really sure why it's needed, though, so I'm going to wait a bit to see if someone has a nice explanation.

Update 2: I was asked to give more information. Unfortunately, what I described is almost all I have. This is in third-party code. The method, which resides on a different DLL, is declared like this:

class MyClass
{
 public:
 // ...
 _declspec(dllimport) static const char *getDirectory(void);
}

and it is invoked like this:

MyClass::getDirectory ()

I haven't got the source. It was compiled on Debug mode under VC++9.

A: 

That's probably because your static function is defined inline.

My test with this class:

class myclass
{
public:
    static int inlinetest() 
    { 
        return 0; 
    }
    static int test();
};

int myclass::test()
{
    return 0;
}

gives me this output in my immediate window:

myclass::inlinetest()
CXX0052: Error: member function not present
myclass::test()
0
fretje
@fretje It's not inline - this class in another, closed source, DLL. I've actually managed to get it to work (see my update), but I don't really know why.
Pedro d'Aquino
A: 

Well, I'm not sure why, but the debugger isn't smart enough to know that class is in another DLL, so you have to explictly tell it by using the context operator:

{,,MyDLL}MyClass::myMethod()
Pedro d'Aquino