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 πŸ™‚

Advertisements

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

  • Style Transfer is fun! TensorFlow rocks! #WTM17 https://t.co/zYP0IFIDfp 1 month ago
  • couldn't get over the jetlag, sleeping during the day from seven to four, for days. 3 months ago
  • is emptying trash and happily discovering the available disk space now ranks at 100G+. 4 months ago
  • is looking at other people's intentions, not their capabilities, and feeling much happier every day :) 1 year ago
  • is planning on how to spend the next two weeks until the new year, at home. 1 year ago

Flickr Photos

IMG_3517

IMG_3515

IMG_3505

IMG_3497

IMG_3261

IMG_3260

IMG_3255

IMG_2736

IMG_2733

IMG_2629

More Photos
%d bloggers like this: