Friday, September 24, 2010
Testing with Google's C++ Test Framework (gtest)
The other day I was playing around with Google's C++ Testing Framework (a.k.a. gtest). I tried to build the Code with Visual Studio 2008 Express and got some strange linker errors. I was able to solve the errors thanks to this site. In essence, I had to change the "Runtime Library" Setting in the C/C++ Code Generation options to "Multi-Threaded" for a release build and to "Multi-Threaded Debug" for a debug build.
Wednesday, August 25, 2010
Linker Sets
Reminder: When placing something in a dedicated section using __attribute__((section("foobar"))), the GNU toolchain will automatically add a symbol __start_foobar at the beginning and a symbol __stop_foobar at the end of the section.
However, you will need a reference to that symbol in order to prevent the linker from optimizing the symbol away. In other words, you need to declare something like extern void *__start_foobar; and use it.
When using the Microsoft toolchain, the symbols need to be added explicitly. To do that, one can make use of the fact that when the Microsoft linker encounters several sections with a "$_" in their name, it will merge the contents into one final output section. The name of the output section will be the common prefix of the declared sections. The beauty is that the contents are in the order of the section names.
Here's an example: Supposed you placed something into a section called "foobar$_something". You can then add a variable __start_foobar into a section "foobar$_a" and a variable __stop_foobar into a section "foobar$_z". The resulting binary will have one section "foobar" with the contents of variable __start_foobar placed at the beginning, followed the contents of everything in section "foobar$_something" and the contents of the variable __stop_foobar at the end.
However, you will need a reference to that symbol in order to prevent the linker from optimizing the symbol away. In other words, you need to declare something like extern void *__start_foobar; and use it.
When using the Microsoft toolchain, the symbols need to be added explicitly. To do that, one can make use of the fact that when the Microsoft linker encounters several sections with a "$_" in their name, it will merge the contents into one final output section. The name of the output section will be the common prefix of the declared sections. The beauty is that the contents are in the order of the section names.
Here's an example: Supposed you placed something into a section called "foobar$_something". You can then add a variable __start_foobar into a section "foobar$_a" and a variable __stop_foobar into a section "foobar$_z". The resulting binary will have one section "foobar" with the contents of variable __start_foobar placed at the beginning, followed the contents of everything in section "foobar$_something" and the contents of the variable __stop_foobar at the end.
Monday, March 22, 2010
Fix Windows Full Text search
I've recently noticed that using the Windows full text search may not always turn up the expected results. Apparently, Windows requires a program to install a search filter for a given file type. There is some plain text filter available by default, but it's only registered for some endings. Source code files, e.g. Groovy files, will not be included, even though they contain nothing but plain ASCII text. Anyways, there's a fix available, but it's nowhere near intuitive...
Thursday, November 26, 2009
Building qfsm on Ubuntu 8.04
I just tried to build qfsm on Ubuntu 8.04. The only dependencies listed by qfsm are CMake and Qt 4.3.x - both of which are available through the Ubuntu packet manager.
However, when I followed the instructions provided along with the qfsm source code, I encountered this error message:
However, when I followed the instructions provided along with the qfsm source code, I encountered this error message:
[ 41%] Building CXX object CMakeFiles/qfsm.dir/src/ExportAHDLDlgImpl.o
In file included from qfsm-0.51.0-Source/src/ExportAHDLDlgImpl.h:21,
from qfsm-0.51.0-Source/src/ExportAHDLDlgImpl.cpp:21:
qfsm-0.51.0-Source/src/ui_ExportAHDLDlg.h:27: error: expected constructor, \
destructor, or type conversion before ‘class’
make[2]: *** [CMakeFiles/qfsm.dir/src/ExportAHDLDlgImpl.o] Error 1
make[1]: *** [CMakeFiles/qfsm.dir/all] Error 2
make: *** [all] Error 2
It turns out that the definition of the QT_BEGIN_NAMESPACE macro was nowhere to be found on my system. Luckily, removing the corresponding lines in the qfsm source code allowed me to build the code just fine. I used this one-liner to remove the offending lines:
$ for file in `grep -R QT_BEGIN_NAMESPACE * | awk -F : '{ print $1; }'` ; \
do sed -i -e '/QT_.*NAMESPACE/d' $file ; done
Friday, September 18, 2009
Graphics Card
For some reason I have to look up the model of the graphics adapter in my thinkpad everytime I do an update... so here it goes: My T61p has a Quadro FX 570M in it.
Subscribe to:
Posts (Atom)