[rabbitmq-discuss] Running rabbitmq client on visual studio 2005

Jerry Kuch jerryk at vmware.com
Tue Nov 9 08:55:43 GMT 2010


Hi, Vincent.

I don't have a Windows box in front of me, indeed haven't seriously touched Windows in quite a while, but this is typically the result of either mismatched types (e.g. you've got a header file or typedef claiming a function's type is something that it really isn't) or incompatible calling conventions between caller and callee.  In either case you end up with a number of bytes pushed on the stack at call time, with commensurate adjustment of the stack pointer, and the SP isn't being restored properly afterward.

For historical reasons dating back to the earliest 16-bit versions, Windows is blessed with a number of strange calling conventions that differ in such things as what order the arguments get pushed on the stack and who's responsible for cleaning up and resetting the stack pointer when a function finishes.

Over the years you'd see function prototypes annotated with things like STDCALL, CALLBACK, CDECL, PASCAL, WINAPI, etc.  MSDN should document these in detail, and beware there are many synonyms.  In the cave times this allowed Windows apps to be slightly smaller by reducing the amount of code that had to be generated at Windows API call sites by entire bytes.

First I'd take a peek into the source for the C client library, and any include files you're pulling in to make use of it and make sure you know what the calling conventions are.  If you're defining callbacks in your code that will be invoked by stuff in the library, make sure those functions really have the signatures the caller wants.   Also, if you or any code between you and the library have typedef'ed any function pointers for convenience, make sure those types really and truly match those of the functions the DLL is exporting.

Jerry

On Nov 9, 2010, at 8:33 AM, Vincent Cheong wrote:

I have downloaded the rabbit mq c client from http://hg.rabbitmq.com/rabbitmq-c/summary and compiled the the library using mingw successfully.

However when I compile against the library (librabbitmq.dll.a) and run my application, I get a run-time check failure of the value of esp being not properly saved. Any help would be deeply appreciated.
<ATT00001..txt>



More information about the rabbitmq-discuss mailing list