Hi,
Im currently creating an object that inherit a base class named BaseObject, in my DLL, and Im sending it to my application using a static function declared in my application.
The problem is that the object looks corrupted when the exe receives it.
Does anyone knows what could make this problem?
Here is how my object looks like after I created it in my DLL: http://prookle.com/vbimghost.php?do=...yimg&imgid=127
Then, I pass this object using a static function.
When my application receives it, the object looks like that:
http://prookle.com/vbimghost.php?do=...yimg&imgid=126
As you can see, the data is not the same.
Here is what the BaseObject class looks like:
Code:#ifndef _BaseObject #define _BaseObject #ifndef API_DLL #ifdef CORE_EXPORTS #define API_DLL //__declspec(dllimport) #else #define API_DLL __declspec(dllexport) #endif #endif #include <vector> #include <iostream> using namespace std; #include "APITypes.h" class API_DLL BaseObject; typedef void (BaseObject::*EnterExitFn)(uint32); typedef void (BaseObject::*StateFn)(float); struct State { EnterExitFn mEnterFn; StateFn mStateFn; EnterExitFn mExitFn; uint32 muiStateId; }; struct Test { uint32 uiId; float fValue; }; class API_DLL BaseObject { public: BaseObject(uint32 _uiObjectId); void SetStateFn(uint32 _uiStateId, StateFn _stateFn, EnterExitFn _stateEnter = NULL, EnterExitFn _stateExitFn = NULL, bool _bStopSet = false); void SetState(uint32 _uiState, bool _bStopSet = false); void Update(float _fDelta); uint32 GetObjectId(); //virtual: virtual uint32 SendMessage(uint32 _uiMessageType, void* _messageData){return 0;}; private: uint32 FindStateIndex(uint32 _uiStateId); protected: vector<State> mvuiStates; uint32 muiObjectId; uint32 muiCurrentState; uint32 muiLastFrameState; bool mbHasStates; bool mbCallEnterFn; bool mbCallExitFn; }; #endif
Here is how I pass the object from the DLL to the application:
Code:Mouse* pMouse = new Mouse(6); APIGameObject::RegisterObject((BaseObject*) pMouse);
The mouse class inherit the BaseObject class. The RegisterObject function is a static function declared in the application.
When I break in the RegisterObject static function, the object in parameter looks like this: http://prookle.com/vbimghost.php?do=...yimg&imgid=126
But, when I create the mouse object, it looks like this: http://prookle.com/vbimghost.php?do=...yimg&imgid=127
Hope someone can help me out,
Steve