Using libmemcached on a Windows system
Hi
I'm brand new to the world of Membase Server so apologies in advance if I ask any stupid questions.
I am working on a C++ windows application where we'd like to make use of memcached, so Membase Server in pure memcached mode seems like a perfect fit. libmemcached seems like the client of choice to use for C++ based applications (it is fully featured, mature and actively developed) but it doesn't seem like there is an easy way to get libmemcached running under Windows. I have started following the instructions here
http://trondn.blogspot.com/2010/07/libmemcached-on-win32.html
and have got to the point where I have created a libmemcached-8.dll file. I have also set up a project containing the libmemcached header files to include in my application. The problem I'm having is that I need to link against a static library, not a dynamic link library and I don't have one available. I could attempt to make one following the advice given here
http://www.coderetard.com/2009/01/21/generate-a-lib-from-a-dll-with-visu...
but it seems like a lot of work, and also I don't want to have to do this every time a new version of libmemcached is released.
So, I was wondering if anyone has any advice or ideas on an easier way of working with libmemcached (or any other suitable client library) on a Windows platform.
Many thanks in advance.
Kevin
Thank you very much for the reply ingenthr.
You're right, I could try to edit the make file so that it will generate a static library but being a Windows programmer (sorry!) I'm not very confident about doing this. If you think it wouldn't be particularly difficult then I could give it a go...
The reason I need a static library is that Microsoft Visual Studio requires a static library to link against (just the .dll isn't enough unfortunately). The good news is I have now managed to build a static library from the .dll and have successfully built and ran my application (I needed to add libgcc_s_dw2-1.dll and libstdc++-6.dll to the application executable directory too).
The only problem I seem to have now is that if I use the C++ interface to libmemcached I get a heap corruption issue every time the C++ wrapper code makes a call to free(). (I have been able to test that I can successfully store and retrieve items from memcached by temporarily commenting out the calls to free (as the C++ wrapper code is implemented entirely in header files) but this is obviously unacceptable as it is a memory leak.) I think it could be something to do with libmemcached.dll allocating memory using one system and the C++ interface trying to free it using another system, but I'm not really sure. If anyone has any ideas what is happening here then any help would be much appreciated.
I also are trying to build libmemcached on Windows. But it is Failure for using libmemcached-1.0.15.tar.gz . I thought it would be successful after reading the file "README.win32" in the dir "libmemcached-1.0.15".I do not know if I was wrong.
I am amazed you got this far considering you compile the library with GCC++ and invoke it from VC++.
Have you been able to get this fully working?
It seems like the best thing to do would be to add to the instructions in Trond's post, or even add to the Makefile or NMakefile the needed bits to generate your static library. I'm sorry I don't have many better suggestions.
What is it that is driving the need for the static library? With dynamic libs, it'll be easier to absorb patches from the project. I'd be interested to know if there's some deployment case we don't have well covered without static libraries.