|
-
May 28th, 2008, 03:53 PM
#1
A compiler bug?
Hi,
I am exporting a class through a dll, which is then invoked via an application.
The class is abstract, but then concrete implementations are provided through derived classes. One of the functions of the abstract base class is causing problem that happens at the runtime. Note that compilation and linking is perfect.
The relevant portion of the class is something like:
Code:
class MYDLL_API CMyClass
{
public:
virtual void AddToContainer( CMyContainer* pContainer, int nType = TYP_INVALID ) const {
assert( pContainer );
assert( nType != TYP_INVALID );
}
};
The application runs well in the Release mode, but not in the debug and ReleaseWithDebugInfo. The following error message box is displayed:
Code:
The procedure entry point ?AddToContainer@CMyClass@@UAEXPAVCMyContainer@@H@Z could not be located in the dynamic link library MyDll.dll
When I comment out the asserts, it works for the Debug Mode, but not for the ReleaseWithDebugInfo (Which is nothing but Release build with turned off optimizations).
In the nutshell, I have to add an overloaded function (non-constant this time) in the class to make it work for all cases.
Code:
virtual void AddToContainer( CMyContainer* pContainer, int nType = TYP_INVALID ) {
assert( pContainer );
assert( nType != TYP_INVALID );
}
Any ideas why this is happening? Am I missing something?
Best,
SB
-
May 28th, 2008, 04:08 PM
#2
Re: A compiler bug?
How is "MYDLL_API" (conditionaly) defined?
Can you zip up a minimal, console solution the demonstrates the issue?
gg
-
May 28th, 2008, 04:21 PM
#3
Re: A compiler bug?
 Originally Posted by Codeplug
How is "MYDLL_API" (conditionaly) defined?
The dll is generated through project wizard in VC2003. In that sense MYDLL_API is standard:
Code:
#ifdef MYDLL_EXPORTS
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif
The dll indeed exports the function, but apparently with incorrect mangling.
Please note that there is no problem if the function is made non-constant OR a second non-constant member function is added.
 Originally Posted by Codeplug
Can you zip up a minimal, console solution the demonstrates the issue?
I am not sure if I can reproduce the problem in a small test dll. But I may give a try.
Thanks
SB
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|