Here is the error I get after calling a method (described below) : Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
This is the code (simplified), the crash happend on line 49. I give some explainations after. -
-
//-------------------------------------------------------------
-
class MyBaseClass
-
{
-
//...
-
};
-
-
//-------------------------------------------------------------
-
class MyInterface
-
{
-
public:
-
virtual void OnTrigger(NxActor* actor1, NxActor* actor2) = 0;
-
};
-
-
//-------------------------------------------------------------
-
class MyClass : public MyBaseClass, public MyInterface
-
{
-
public:
-
MyClass();
-
void OnTrigger(NxActor* actor1, NxActor* actor2); // called from a subsystem
-
// when an event is raised.
-
-
private:
-
NxActor* m_actor;
-
}
-
-
//-------------------------------------------------------------
-
MyClass::MyClass()
-
{
-
m_actor = CreateActor(); // create an actor for a particular sub system
-
// (PhysX)
-
m_actor.userData = this; // hold the instance pointer to have a 1:1
-
// mapping between my instance and the actor
-
// (userData is a void*)
-
}
-
-
//-------------------------------------------------------------
-
void MyClass::OnTrigger(Actor* actor1, Actor* actor2)
-
{
-
}
-
-
//-------------------------------------------------------------
-
// The subsystem event callback
-
//-------------------------------------------------------------
-
void OnSubSystemTrigger(NxActor* actor1, NxActor* actor2)
-
{
-
if (actor1.userData)
-
{
-
MyInterface* obj = (MyInterface*) actor1.userData; // cast
-
obj->OnTrigger(actor1, actor2); // Call the method.Here is the crash
-
}
-
}
- I checked if the value of userData didn't change between the constructor and the call. It is the same (eg : 0x0055c108).
- Just after the cast, obj is not valid "inside". When I use the VStudio watch on <MyInterface* obj> (line45) I get messy values : - - MyInterface obj 0x0055c108
-
- MyClass
-
- MyBaseClass
-
__vfptr 0xfdfdfdfd *
-
- MyInterface
-
- _actor 0x00000065 {userData=??? } NxActor *
- And finally I get no error if iswitch the inheritance order from :
class MyClass : public MyBaseClass, public MyInterface
to :
class MyClass : public MyInterface, public MyBaseClass
Any idea ?
Thanks!
1 3877
1) You are not calling your base class constructors in the MyClass constructor. That is, you need an intialization list where you call the base class constructors. The automatci calling of base class constructors has been disabled for multiple inheritance. This was done to prevent common base classes from having their constructors called multiple times.
2) Ditch that void*. A void* in C++ manes your calling a relci C function ir b) ytour design is screwed up.
3) You never cast in C++ as part of your normal coding style. If the C++ compiler cannot figure out your type, then you have real problems. If you need to be in charge of things, switch to C where nothing is done to help you.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: James |
last post by:
Hi,
I would like to run a custom script on a linux box via a button on a php
page (php webpage hosted on the same linux box).
Is this possible? If so , can you give me a pointer in the right direction?
thanks
James
|
by: hakim |
last post by:
Hi,
I need some information ?
How I can run my project (Php) on CGI.
Thanks.
|
by: Pedro Werneck |
last post by:
Hi,
I don't know if I should ask this here or on an emacs group/list. If I choose wrong, please forgive me.
I am trying to run pychecker on the current buffer on python-mode using the py-pychecker-run command, but it fails with the "Symbol's function definition is void: read-shell-command" error. I don't know elisp, but seems this is the point where the error occurs:
;; Pychecker
(defun py-pychecker-run (command)
"*Run pychecker...
|
by: leroybt.rm |
last post by:
Can someone tell me how to run a script from a interactive shell
I type the following:
>>>python filename
>>>python filename.py
>>>run filename
>>>run filename.py
>>>/run filename
>>>/run filename.py
|
by: Jonathan Polley |
last post by:
I have one account on a WindowsXP machine that refuses to run IDLE (or
any other python script that uses Tk). Other people can login to that
PC and IDLE runs just fine, so it is not an installation issue. When
the person who has the problem logs into another PC the problem follows
them. Any ideas as to what might me wrong?
This is the traceback from IDLE:
C:\Python20\Tools\idle>..\..\python.exe idle.py
Traceback (most recent call...
| |
by: Kyle |
last post by:
To any who chose to provide an answer, or even any suggestions to this
problem, I thank you greatly in advance. +200 pts. for any valid
solutions.
I am currently in the process of converting a website from an existing
web host to our servers. This website used the WScript.Shell command
to execute a series of Java commands that would send an encrypted
email.
I ran these commands directly on the server and they execute properly,
|
by: Mactash |
last post by:
Folks,
I am trying just to run a simple asp commands in the
Internet Explorer. ( I have windows XP)
When I run this asp lines on ASP Matrix web server it is
ok.
But, when I run this on IIS it acts like the asp engine
is not working.
|
by: SiuLoBow |
last post by:
Hi,
Is there anyway to detect the ActiveX control is able to run on the browser
or not?
After I installed the ActiveX control to my system, user sometimes switch
the secruity setting to "not able to run ActiveX control". So, the ActiveX
control just show on the broswer, but not able to run it.
I want to find a way to detect it. And prompt the user a message telling
|
by: Ed |
last post by:
Hello,
I took a course in asp about 2 years ago and I was
practicing with IIS 5.0. Then I put it down for a while.
Now trying to get back to it. I can't run asp files from
subdirectories of my root directory, but I can run asp
files from the root directory of my website and I can run
htm files from the subdirectories. If I run
localhost/mytest.asp
|
by: traceable1 |
last post by:
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |