View the expanded content http://www.cppblog.com/yedy/articles/22882.html

Source: Internet
Author: User
View Macro expansionThere are three methods. Only two methods have been tested, and the last one has not been tested.

  1. Use the GCC command;
  2. Use the Command provided by VC;
  3. Source insightTools;

1. in GCC, run the command-e
The following code

# Include <objbase. h>
# Include <initguid. h>

# UNDEF Interface
# Define interface iexample

Declare_interface _ (interface, iunknown)
{
Stdmethod (QueryInterface) (This _ refiid, void **) pure;
Stdmethod _ (ulong, addref) (this) pure;
Stdmethod _ (ulong, release) (this) pure;
Stdmethod (setstring) (This _ char *) pure;
Stdmethod (getstring) (This _ char *, DWORD) pure;
};

You can save the code as a file in test. h or another format.
Gcc-E test. h> E:/out.txt
Open the out.txt file of the edrive. The following content is displayed at the bottom of the file:

Typedef struct iexample {struct iexamplevtbl * lpvtbl;} iexample; typedef struct iexamplevtbl; struct iexamplevtbl
{
Hresult (_ attribute _ (_ stdcall _) * QueryInterface) (iexample *, const IID * const, void **);
Ulong (_ attribute _ (_ stdcall _) * addref) (iexample *);
Ulong (_ attribute _ (_ stdcall _) * release) (iexample *);
Hresult (_ attribute _ (_ stdcall _) * setstring) (iexample *, char *);
Hresult (_ attribute _ (_ stdcall _) * getstring) (iexample *, char *, DWORD );
};

_ Attribute _ is a keyword of GCC used to describe variable attributes.
2. In VC, you can also add the/p command at the end of project option under project-> setting-> C/C ++ /.
After rebuild all, some errors will be prompted. It doesn't matter. There will be a. I file under the directory where the project is saved.
You can also find the same content as out.txt in the corresponding location.
3. Source insight is also supported, but it has not been tested.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.