Dependent Origination

Redefined macros from other modules

Posted on: July 4, 2012

This solution isn’t found by me — it is found by my teammate. But since we have spent quite some hours trying to get our thing compiled together, I took the liberty of writing it down here🙂

The problem is when we include header files from mongo they have macros defined and undefined in their module. Classes are fine since they are in a separate namespace. Macros are really messy. I tried to include our own headers after theirs so we have those macros available after they undefined theirs (which have the same name as ours, such as LOG!). But it only works to a certain extent, we soon faced mysterious error messages that a template parameter is not instantialized or something like that. My teammate realized that instead of using their classes, you can use them as pointers and that way you only need to forward declaration without include the actual header files. Then you include the actual header files in the implementation files. This way their module is only pulled in during compile time which isn’t polluting everyone else’s namespace with their macros. Well that is the theory we will probably encounter more problems but I think the solution got us really far and is clever and warrants a note🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

July 2012
M T W T F S S
« Jun   Aug »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Twitter

  • is looking at other people's intentions, not their capabilities, and feeling much happier every day :) 11 months ago
  • is planning on how to spend the next two weeks until the new year, at home. 11 months ago
  • is going to have human company for Thanksgiving; a rare event for the past like twenty years. 1 year ago
  • living by myself again; a strange feeling in a bustling city with thirteen million people 1 year ago
  • just came back home after sixteen days on the road; when i set out, the plan was a mere three-day trip 1 year ago

Flickr Photos

IMG_2057

IMG_2051

IMG_2048

IMG_2044

IMG_2042

IMG_2035

IMG_2033

IMG_2030

IMG_2028

IMG_2024

More Photos
%d bloggers like this: