Dll and [Bad Ptr]

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Dll and [Bad Ptr]

Post by alberts »

Hi all,

I'm getting some strange errors which I'm not able to solve. I have created a dll where the class "Test" is declared. The .dll and .lib files are correctly generated.

Code: Select all

namespace Camera2
{
    class DllExport test 
	{
	public:

        test::test(Ogre::String name)
        {            
            mName = name;            
        }        

    protected:        
        Ogre::String mName;
    };

}
I'm trying to make use of this class in another project but when I call the constructor the "name" param is not passed correctly.

Image
Image

I'm almost sure the dll and lib files are up to date. I've added the following pos-tbuild event "xcopy $(OutDir)\$(TargetName)$(TargetExt) $(OGRE_HOME)\bin\$(ConfigurationName) /y" and set the working directory as "$(OGRE_HOME)\bin\$(ConfigurationName)". It only happens with dynamic data. It works perfectly using simple types. I don't know what more to try. Hope you can help me :oops:

Any help will be appreciated :)

Alberto
Last edited by alberts on Tue Sep 29, 2009 10:58 pm, edited 1 time in total.
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Dll and [Bad Ptr]

Post by alberts »

I forgot to mention that if I declare the "test" class to take a pointer type as param (Ogre::SceneManager* or Ogre::Camera*, for instance), in the constructor body the debugger complains about a <Bad Ptr>.
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Dll and [Bad Ptr]

Post by Klaim »

We can assume that you're using debug versions of your dll and application, making your debug infos right, can't we?
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Dll and [Bad Ptr]

Post by alberts »

Many thanks for your interest.

Yes. You can assume that. The .pdb file is generated correctly.

Following are some screenshots with my config.

Image
Image
Image
Image

:(
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Dll and [Bad Ptr]

Post by alberts »

Now that you mention it, I've tried the release mode and the applications runs perfectly. The problem still remains in debug mode :? . I have set the working directory as the "$(OGRE_HOME)\bin\debug" dir. Do I need to copy there any other than the .dll and the .exe (and its .pdb) files?
Post Reply