The QT open source since 4.4 provides builds for Visual C++. Unfortunately the default VC compiler flag is -MD (or -MDd for debug build), which means that the C runtime library is dynmically linked - which also means that you have to carry the MSCRT.DLL everywhere). It is not desirable for our project settings.
I did some research and found a utility called coolbuilder. It can build static lib. However, it proves to be a sh*t, as it failed to build. Worse, it sends out information without my permission.
Sunday, February 22, 2009
Thursday, January 29, 2009
Tricky C code
We have a static library project linked into a DLL. For years, this static library does not require initialization/unitialization code. This time a new feature is added that requires the initialization and cleanup. So we have to call functions when the DLL is attached/detached to the process.
The original DLL does not have a DllMain. We got one by having VC++ create for us, and it did. We did this by creating a new DLL project and copy the function into ours:
It was easy to paste code. Now we invoke functions:
Unfortunately did not work as we expected. Does anyone see the problem?
The original DLL does not have a DllMain. We got one by having VC++ create for us, and it did. We did this by creating a new DLL project and copy the function into ours:
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
}
return TRUE;
}
It was easy to paste code. Now we invoke functions:
case DLL_PROCESS_ATTACH:
InitMyLib();
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
TerminateMyLib();
break;
Unfortunately did not work as we expected. Does anyone see the problem?
Saturday, August 30, 2008
Polymorphism in C
Many people mistakenly believe that polymorph ism has to be done in a OO language, such as C++.
Where it is true that C++ gives a quite straightforward implement, one might be shocked to find out that procedure language may have some advantages.
The techniques are not newly invented. It has been existed for more than a decade. For example, in Windows GDI, a DC represents a output device.
Where it is true that C++ gives a quite straightforward implement, one might be shocked to find out that procedure language may have some advantages.
The techniques are not newly invented. It has been existed for more than a decade. For example, in Windows GDI, a DC represents a output device.
Tuesday, March 18, 2008
std::iostream adaptor for com::IStream interface
I am working on a C++ library that uses std::iostream for all kinds of IO. Now I finished it and started to add a COM wrapper above it. One of the issues is to convert IStream into std::istream. At the first glance, it is not easy since istream has a dozen methods.
Monday, January 28, 2008
Friday, November 23, 2007
Exchange Server Woes
We are a very small company. Many companies at our size do not have servers because they can not afford a dedicated system administrator. But we are different. I got my MCSE 10 years ago, and I thoroughly understand TCP/IP network.
The Exchange server is a core part of the network - the place we archive all e-mails and important documents. The search facility in outlook (the Advanced Search) is fantastic for searching emails and binary files.
Since we are a small company, after we set up the server we have not backed it up once. At that time, we felt that e-mails archives are not quite important, and we can always recover the loss if needed. Today, we have a different view - because we have so many e-mails and documents managed by Exchange.
I noticed that the Exchange server eats disk space very quickly. The hard disk that the exchange server occupies has a capacity of 80GB. When it was installed, it has plenty of space (about 70G). Today we are surprised to learn that there are only 20GB spare space left. I noticed that there are virtually thousands of log files under the MDBDATA folder.
After reading several pages of a book, and reading numerous web pages, I finanlly work out a solution. There is a flag called "enable circular loggin" that you can turn on. In this mode Exchange server will reuse a log file over and over again. The down side is that you can no longer perform differential backup. But hay, a full backup turned out to be only 1.5G for us. We can certainly afford doing full backups every day.
The Exchange server is a core part of the network - the place we archive all e-mails and important documents. The search facility in outlook (the Advanced Search) is fantastic for searching emails and binary files.
Since we are a small company, after we set up the server we have not backed it up once. At that time, we felt that e-mails archives are not quite important, and we can always recover the loss if needed. Today, we have a different view - because we have so many e-mails and documents managed by Exchange.
I noticed that the Exchange server eats disk space very quickly. The hard disk that the exchange server occupies has a capacity of 80GB. When it was installed, it has plenty of space (about 70G). Today we are surprised to learn that there are only 20GB spare space left. I noticed that there are virtually thousands of log files under the MDBDATA folder.
After reading several pages of a book, and reading numerous web pages, I finanlly work out a solution. There is a flag called "enable circular loggin" that you can turn on. In this mode Exchange server will reuse a log file over and over again. The down side is that you can no longer perform differential backup. But hay, a full backup turned out to be only 1.5G for us. We can certainly afford doing full backups every day.
Monday, October 8, 2007
svn_load_dirs.pl woes
I use subversion to manage all software projects. It is a nice utility, much better than the commercial SourceSafe. And it is free. Have not encounter any problems in the past three years.
Today I am trying to upgrade boost from 1.33 to 1.34. There are a lot of changes between the two versions, so it is not possible to manually change them. Furthermore, although WinMerge is nice to show all the differences, it does not understand subversion command. If a file exists in 1.34 but not in 1.33, the correct command is "svn copy" rather than copy.
My installation does not have this magic file svn_load_dirs.pl. I grabbed it from collab: http://svn.collab.net/repos/svn/tags/1.4.2/contrib/client-side/svn_load_dirs.pl.in. I did a copy and paste, and run the command, it gives me an error:
'SVN_BINDIR@' is not recognized as an internal or external command,
Not good. Look further I found the file extension ends with .in. So some work needs to be done to convert it to .pl. Open the file, I found this line:
# Specify the location of the svn command.
my $svn = '@SVN_BINDIR@/svn';
Cool. Changed the line to
my $svn = 'C:\Program Files\Subversion\bin\svn.exe';
and it worked properly.
Today I am trying to upgrade boost from 1.33 to 1.34. There are a lot of changes between the two versions, so it is not possible to manually change them. Furthermore, although WinMerge is nice to show all the differences, it does not understand subversion command. If a file exists in 1.34 but not in 1.33, the correct command is "svn copy" rather than copy.
My installation does not have this magic file svn_load_dirs.pl. I grabbed it from collab: http://svn.collab.net/repos/svn/tags/1.4.2/contrib/client-side/svn_load_dirs.pl.in. I did a copy and paste, and run the command, it gives me an error:
'SVN_BINDIR@' is not recognized as an internal or external command,
Not good. Look further I found the file extension ends with .in. So some work needs to be done to convert it to .pl. Open the file, I found this line:
# Specify the location of the svn command.
my $svn = '@SVN_BINDIR@/svn';
Cool. Changed the line to
my $svn = 'C:\Program Files\Subversion\bin\svn.exe';
and it worked properly.
Subscribe to:
Posts (Atom)
