|
Thanks Perspx, exactly what I had expected.
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
Be carefull with doing that. I remember a problem I had some years ago which consisted also of a singleton in a dll (using static variable). This didn't work because the dll (from which the singleton was coming) had a different instance of the static variable than the exe. Which means that if you have to use the singleton in the exe and in the dll, you will end-up with two copies of the singleton.
|
|
|
|
|
Hi Cedric, can you explain a little bit more about the problem, what was the cause, and how it was resolved? I am sure it will help me to keep your caution in mind while designing in future.
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
After searching for a while, I found back a question I asked on codeguru: see here[^]. I didn't go into too much details though.
|
|
|
|
|
Hi!
My project is compiling fine. But it shows linker errrors.
testAI.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: float __thiscall osgGA::GUIEventAdapter::getYmax(void)const " (__imp_?getYmax@GUIEventAdapter@osgGA@@QBEMXZ)
testAI.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: float __thiscall osgGA::GUIEventAdapter::getYmin(void)const " (__imp_?getYmin@GUIEventAdapter@osgGA@@QBEMXZ)
D:\GUI04072008\Release\GUI.exe : fatal error LNK1120: 2 unresolved externals
I've included all the libraries. What to do?
|
|
|
|
|
did u make an entry in the .def file of the dll?
|
|
|
|
|
I don't know about def file. Where it is located?
|
|
|
|
|
looks like u r using n dll right?
then in the solution explorer u will find n .def file in the source files section.
open it and make an entry of ur function name which u want to export.
|
|
|
|
|
if it still doesnt work then try putting the foll:
?getYmax@GUIEventAdapter@osgGA@@QBEMXZ
(which i took from ur post itself)
Prasann
enjoy
|
|
|
|
|
There's no .def file in my solution. Only source and header files are there.
|
|
|
|
|
Are you sure you link with the lib file that is provided with the dll ?
|
|
|
|
|
|
Are you sure your class is exported in the dll ? Can you post the code of the header file for this class ?
Did you also provide a body for those functions ?
|
|
|
|
|
Here it is:
#ifndef DELTA_TestAI
#define DELTA_TestAI
#include <string>
#include <dtCore/refptr.h>
#include <dtABC/application.h>
#include <dtCore/camera.h>
#include "aicharacter.h"
#include <dtCore/collisionmotionmodel.h>
#include <osg/Matrix>
namespace dtCore
{
class Object;
class Transform;
class CollisionMotionModel;
}
namespace dtChar
{
class Character;
}
namespace dtDAL
{
class Project;
}
using namespace dtCore;
using namespace dtChar;
using namespace dtDAL;
class TestAI : public dtABC::Application
{
public:
TestAI(const std::string& mapName = "vismap6", const std::string& configFilename = "config.xml");
protected:
~TestAI();
public:
virtual void Config();
virtual bool KeyPressed(const dtCore::Keyboard* keyboard, int key);
virtual void PreFrame( const double deltaFrameTime );
private:
void LoadDemoMap(const std::string& pStr);
float mSpeed;
bool mDrawNavMesh;
bool char7start;
unsigned int pWaypointNum[7];
unsigned pAISpeed[7];
unsigned pStopWaypoint[7];
std::string mMapFilename;
dtCore::RefPtr<dtCore::Camera> mOverheadCamera;
dtCore::RefPtr<dtAI::AICharacter> mCharacter1;
dtCore::RefPtr<dtAI::AICharacter> mCharacter2;
dtCore::RefPtr<dtAI::AICharacter> mCharacter3;
dtCore::RefPtr<dtAI::AICharacter> mCharacter4;
dtCore::RefPtr<dtAI::AICharacter> mCharacter5;
dtCore::RefPtr<dtAI::AICharacter> mCharacter6;
dtCore::RefPtr<dtAI::AICharacter> mCharacter7;
dtCore::RefPtr<dtCore::Object> m_Obj;
osg::Matrix mCameraOffset;
dtCore::RefPtr<CollisionMotionModel> mMotionModels;
protected:
osg::ref_ptr<osg::Node> _node;
float _velocity;
osg::Vec3 _eye;
osg::Quat _rotation;
osg::ref_ptr<const osgGA::GUIEventAdapter> _ga_t1;
osg::ref_ptr<const osgGA::GUIEventAdapter> _ga_t0;
float _distance;
void computePosition(const osg::Vec3& eye,const osg::Vec3& lv,const osg::Vec3& up);
void flushMouseEventStack();
};
#endif // DELTA_TestAI
Yes. I defined all the declared functions.
|
|
|
|
|
No, I was talking about the osgGA::GUIEventAdapter class, the one from the dll. Did you write this dll ? If not, from where is it coming from ?
|
|
|
|
|
How to created a well-formatted xml document like this using MSXML(I'm using MSXML6)?
<?xml version="1.0" encoding="utf-8"?>
<!--there are some comments-->
<root>
<node1>...</node1>
</root>
I found no way to add a CRLF after the ProcessInstruction and the first comment, but I do know how to add a CRLF in root node——Just createTextNode and add to the root element.
So my program will always create a xml document like this
<?xml version="1.0" encoding="utf-8"?><!--there are some comments--><root>
<node1>...</node1>
</root>
Please help. Thanks
A Chinese VC++ programmer
|
|
|
|
|
|
Hi all
I have a MDI Application and i am Adding a resource type new Dailog. And in this dailog i have taken a List Box.In this dailog i am calling in .cpp file of MDI.It is working in proper way.
Currently out is showing on MDI Application.But I want to show Out put on listbox. Plz help me
|
|
|
|
|
Hello !
I have declared an byte array say,
BYTE abyData [256];
since i donot know how much memory is exactly necessary.
now in a function i used only 20 bytes of memory i.e
abyData [0] = 23
abyData [1] = 21
.
.
abyData [19] = 45
Now I want to free/release rest of the memory from 20 - 255 ?
|
|
|
|
|
kapardhi wrote: BYTE abyData [256];
You cant do that..
You can use new/delete Or malloc/free for allocating the memory you need.
Regards,
Sandip.
|
|
|
|
|
Allocate 20 bytes of memory then copy the data you need to this new BYTE array then free delete the old one.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
I think he is using Static array..
|
|
|
|
|
Oh right - the delete keyword will do nicely in that case
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
Delete an array in the stack ?
Your program will certainly crash if you try to do so.
|
|
|
|
|
Don't do it. If you know at design time that you will only have 20 bytes, then use an array of 20 bytes. If you don't know the size upfront (but if it is below 255), then keep your current solution. It's not a big deal that you allocated a bit too much memory. This memory will anyway be deleted when you exit the function.
You will probably end-up with a worse solution trying to optimize that than what you have now.
|
|
|
|