error with GetCustomAttribute and general debugging question

shaft

03-04-2006 21:45:13

I have a specific question namely my "GetCustomAttribute" function throws an exception "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." No problems are showing in the log file. (I'm using VC# 2005, on windows xp)


root = new Root();
Initialiser.SetupResources("resources.cfg");
root.ShowConfigDialog();

renderWindow = root.Initialise(true);

IntPtr hWnd = new IntPtr();
renderWindow.GetCustomAttribute("HWND", hWnd);


Second, is there a way to single step into the OGRE (C++) code? Its frustrating that I have the C++ source code but can't see where it is crashing as I could back when I was just doing pure C++ development. This probably a dumb question, but I'm pretty dumb with regard to C# and cross language development.

thx

rastaman

04-04-2006 02:20:22

Try this in OgreNet/OgreRenderTarget.i add this befor the line "%typemap(cscode) Ogre::RenderTarget"


// virtual void getCustomAttribute(const String& name, void* pData);
%typemap(ctype) void* pData "void*"
%typemap(imtype) void* pData "ref IntPtr"
%typemap(cstype) void* pData "ref IntPtr"
%typemap(in) void* pData %{ $1 = (void*)$input; %}
%typemap(csin) void* pData "ref $csinput"


It will make the pData parameter by ref.
Rebuild OgreBindings (that should run swig again if not do it manualy and build) then build OgreNet

ElectricBliss

04-04-2006 13:20:59

shaft:
Second, is there a way to single step into the OGRE (C++) code? Its frustrating that I have the C++ source code but can't see where it is crashing as I could back when I was just doing pure C++ development.
This is a concern for me too, as I believe the answer to your question is... no.

I'm hoping that once I get a solid set of dlls that the need to step into the cpp will be nil.
I guess, in a worst-case scenario, one could log the snot out of a problem area... but this is disgusting.

The RAD nature of c# is pushing me to take a chance and see how it goes. I’m hoping for the best…

Sincerely,

EB

shaft

04-04-2006 19:29:32

Well the "ref" part eliminated my exception. Still can't embed ogre into GTK *yet*, but atleast its not crashing.

Thanks