TokyoCabinet (TC) is a wonderful open-source key-value pair database library by Mikio Hirabayashi, part of his TokyoProducts suite. TokyoTyrant (TT) is the networked portion of it (i.e. the database client & server). Since I am working on a project in Visual Studio under Windows and set out to use TC over the network, I needed to access the TT client API with MSVC.
The TT server runs under Linux (formerly inside coLinux, but now on a 64-bit version launched from a USB flash disk). As I found out, TC can compile in its entirety under Cygwin, while TT cannot due to its use of the asynchronous-IO/epoll API. I was able to work around this problem by not compiling the TT server code (keeping the client API). The Cygwin route is a little more complex than using a native Windows DLL: one must statically link to the Cygwin-compiled DLL in VC, prepare the stack for CygTLS and initialise the Cygwin sub-system at runtime (see the included CygwinLoader.h header). Therefore I set about compiling TT under MinGW with the help of Bloodshed's Dev-C++. With some more modification of the source, I was able to compile a Win32 DLL for TC and TT, however the TC DLL is lacking all the database APIs since there is no 'mmap' function available under Windows, and there was no reason (as yet) for me to write a wrapper for the equivalent Windows functions. If they are required, the included Cygwin version can be used as the Cygwin emulation layer does wrap 'mmap'.
The following is the Read Me file inside the first attached RAR archive:
MinGW DLLs only contain TC utilities and TT client code. TC database code is omitted, as is TT server. The MinGW package is only for connecting to a TT server from a Windows client. The Cygwin package contains the full TC API, and the TT client API. Compiled and packaged by Balint Seeber (balint at the domain spench dot net) The original source is modified here to allow inclusion from a MSVC-project. You should also have the relevant headers available (e.g. pthread.h) Original source versions: tokyocabinet-1.4.26 tokyotyrant-1.1.28 Copyright (C) 2006-2009 Mikio Hirabayashi (As of 16/10/09, the newer TC/TT versions don't contain any new code/fixes that affect client connection to the server according to the changelog on SF.net) MinGW DLLs compiled with Bloodshed Dev-C++ v4.9.9.2 Libs re-created with GNU dlltool (from Cygwin, must be version >= 2.18 to produce correct DLL import libs for VC) The original source was also modified separately to allow it to compile under MinGW (e.g. replacing errno with WSAGetLastError and checking WSA error constants). This 'compilation code' is different from the packaged 'inclusion code' since only the headers from the 'inclusion code' are used (although the packaged .c are modified, it was a failed attempt to create a native MSVC port).
Both styles of 32-bit DLLs, libs and headers are attached below (the MinGW DLLs are only for using the TT client API, while the Cygwin DLLs allow this and complete access to the TC database API). The DLLs should be virus-free, but you can always double-check with Jotti. The original source can be found on SourceForge.
Comments
problem with aio.h
I try to compile tokyotyrant on cygwin, but the cygwin doesn't provide aio.h, so how do to solve this problem when compiling TT? I found that the aio only being used on tculog. Can I make the TT without any logging?
aio.h
You need to have a look at the TokyoTyrant/myconf.h header in the attached file. You'll see that that entire section of #includes is commented out. It is used by the server portion of TokyoTyrant, which you cannot run under Cygwin because it does not provide those services. You can, however, compile the client portion, which how the attached files are configured.