You learn something new every day


I'm writing some tests where I need to log calls to function for the test log so that I can make sure the function is called in the expected way when the test runs. The logging version of the object under test derives from the object and adds the logging functionality and calls the object under test to do the work. Of course, for this to work, the functions that I'm interested in can't be private. Some of them were and I was dissatisfied with my current solution (reclassify them as protected because the test needs to access them) and I didn't really want to have the code under test declaring friendship to the logging code from the test library, so I tried a hack, and it didn't work...

I decided that I'd be cheeky at the point where I included the headers for the real objects into the logging code. I added #define private protected before the #include and #undef private after the #include. The test compiled, as expected, and then failed to link...

It seems that VC 6 mangles the access level into the function signature. I wasn't expecting that. The code under test is defined without my nasty hack and so the functions are private in the library that the test harness links to. The function signature seems to encode that fact so that when I try and link to the library from the test harness that uses the hack the linker can't find the function because there's no function with the correct signature...

I didn't expect that. I'm pleased the compiler does it though; the 'fix' was one of those horrible Monday morning hacks that should never see the light of day.



I just visited your site, from where i saw a source code related to SSL. But this code is limited to SSL clients. Did you integrated the SSL code in your servers framework ?? If yes, then is it publically released?? If yes, then from where can i get it?


Yes we've integrated the Open SSL work into our server framework. Yes it's available for clients. It's not currently free. Drop me a mail to discuss.

Leave a comment