473,834 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serious bug discovered in VC .NET (2002) compiler. [event_source(na tive)] and __event methods

Serious bug discovered in VC .NET (2002) compiler.

Example below should work if I understand the Microsoft documentation
correctly.

Hopfelly there is some compiler upgrade that fixes this bug?
[event_source(na tive)]
class CTubeDev {
....
__event void OnEnableControl s(const BOOL abEnable);
....
};
[event_receiver( native)]
class CPowerDlg : public CDialog {
....
void DoEnableControl s(const BOOL abEnable);
....
}

Somewhere in CPowerDlg I call the hook function only once:

__hook(&CTubeDe v::OnEnableCont rols,m_pDev, &CPowerDlg::DoE nableControls);

I take care that the __hook is only called once and no __unhook is called
before a __hook.

So when I call OnEnableControl s() from a CTubeDev instance, then the
DoEnableControl s() is correctly called, processed but when returning back to
the CTubeDev instance I get an access violation.

Reverse engeneering suggests that there is a node->next pointer that is not
initialized to NULL in the events list handler when the class is created.

A very dirty fix so far to make this system work as it should, is to try to
find the hidden generated attribute created by the __event keyword, and
initialize this to NULL in the constructor, like this.

//--------------------------------------------------------------------

CTubeDev::CTube Dev()
{
__eventHandlerL ist_CTubeDev_On EnableControls= NULL;
.....
}

Reverse engineering suggests that the hidden attribute names generated by
__event is of format:

__eventHandlerL ist_<ClassName> _<EventMethod>

Nov 16 '05 #1
1 1299
I want to add that I do not use managed code, and I link with the multi
threaded static libraries.
And this too might help:
Compiler directives :

/GA /I "..\..\base " /D "_MBCS" /FD /EHsc /RTC1 /MTd /Zp16 /GS /Gy
/Fp".\Debug/TubeDev.pch" /Fo".\Debug/" /Fd".\Debug/" /FR".\Debug/" /W3
/nologo /c /Wp64 /Zi /TP
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2354
by: Anthony Baxter | last post by:
To go along with the 2.4a3 release, here's an updated version of the decorator PEP. It describes the state of decorators as they are in 2.4a3. PEP: 318 Title: Decorators for Functions and Methods Version: $Revision: 1.34 $ Last-Modified: $Date: 2004/09/03 09:32:50 $ Author: Kevin D. Smith, Jim Jewett, Skip Montanaro, Anthony Baxter
2
1005
by: Michael Kennedy [UB] | last post by:
public __gc class CWADataManagerEvents { public: __event void CreateGauge(String * type, bool shared, String * name, GaugeCreateSettings * settings); __event void SetupGauge(unsigned short GID, unsigned int key, System::Byte settings ); __event void SetGaugeValue(unsigned short GID, unsigned int key, System::Byte values , System::Byte attributeID); __event void DisconnectGauge(unsigned short GID, unsigned int key);
5
2886
by: Joe Thompson | last post by:
Hi, I am using VC++.Net 2003 with WinForms to write a serial port application. I downloaded the newest VC++ examples from MSDN and found a project called Using the COM Port. In it, there is a class called Rs232. It has three lines of code: // These events allow the program using this class to react to Comm Port events.
1
1414
by: | last post by:
I want to hook events handlers but need to test of any event handler is assigned or not. I need something like this: __event void OnEventHandler(Myfunc) .... if (OnEventHandler) OnEventHandler(Myfunc); else DoMyFunction(Myfunc); ....
2
2866
by: Boris Fortes | last post by:
I need to unhook event receiver as result of native C++ event. It unhooks successfully, but __raise does not return and throws access violation. Visual Studio 2003 How to reproduce: Consol Win32 exe project
0
218
by: Lord2702 | last post by:
Sun. Aug. 29, 2004 5:00 PM PT I have a user control class which defined as follows... public __gc class MyControl : public UserControl { //---- //-- other fields methods and properties. //--- public:
0
1113
by: Dave L | last post by:
I just upgraded from VS .NET 2002 to 2003. Everything built okay, but strange bugs started appearing. Apparently there is a bug in the managed C++ compiler in regards to handling of static __events. In short, every new instance of the class clears all existing listening registered delegates. It should, of course, preserve all delegates since its static, but it does not according to this: "The real problem is the instance constructor...
1
1023
by: Edward Diener | last post by:
I have a __gc class, let's call it ClassB, derived from ClassA, which has an __event, and eventually derived from System::ComponentModel::Component. This ClassB has no __event. I derived another class from ClassB, let's call it ClassC, which has an __event. When I try to compile ClassC's source I get: somepath\ClassC.h(119) : error C3701: 'somePath\ClassB.h': event source has no events Line 119 in somepath\ClassC.h is the closing brace...
2
4068
by: Michael Reichenbach | last post by:
http://www.remotesoft.com/linker/intro.html it costs far about $1000. Did someone test it?? Is this serious? Or is there some free or at least more cheap alternative? Why there is no native compiler direct from microsoft inside .net sdk? That you need to install .net framework in order to run programs written in .net is one of the biggest disadvantages of .net. People who want portable software (for usb drives), running on all windows...
0
9799
marktang
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...
1
10550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10220
tracyyun
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...
0
9332
agi2029
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...
1
7760
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6957
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();...
0
5796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4427
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
3
3083
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.