[aspectc-user] MFC/ac++

Law, Colin colin.law at epid.eurotherm.co.uk
Mon Feb 11 14:21:56 CET 2002


It appears that I may have the rather dubious honour of being the first to
construct a Windows MFC application using aspect c++ to generate aspect
oriented code.

In case anyone is interested I initially included the standard mfc headers,
having converted the end of line characters to unix format.  This proved
difficult due to the fact that the mfc headers are extremely tortuous and
were testing ac++ beyond its current limits. In addition the time taken to
parse them is significant.  I therefore tried an alternative approach of
generating dummy mfc headers, providing just enough capability to compile
the code using ac++.  This proved fairly easy, though it will be an ongoing
activity as the code is extended to use further mfc features.  In the longer
term it will no doubt be practical to include the microsoft headers.  I use
ac++ to handle the aspects then build the application using the microsoft
compiler as normal.

My simple test case displays a message box each time OnInitDialog is
executed for any of the dialogs for which OnInitDialog is provided in my
application.

On a separate issue is it a known restriction that typedef types do not work
in pointcut expresions?  I have
typedef int BOOL;
pointcut initDialog() = execution("BOOL %::OnInitDialog()");

where OnInitDialog is also declared as a BOOL.  This did not generate errors
but did not recognise OnInitDialog.  When I changed the return type to int
in the pointcut and the function then all was well.

Is there a documented list of what is supported in the compiler? I had a
look on the web site but could not find one.

Colin Law




More information about the aspectc-user mailing list