I'm linking against PocoUtil.dll to use the windows registry access methods. When returning from WinRegistryKey::getString I get the _CrtIsValidPointer assertion. I traced the execution in debug mode, everything seems to be fine when executing the last lines of the method :

> Make sure that your executable and DLL are using the same runtime library.

Thanks. Now I understand why it can happen. But I still don't understand why it should happen to me because I'm using the same version of Visual Studio to compile the Poco DLL and my project linking with the DLL. So it should be the same version of the CRT library that is used on both sides.

> > Do you know how to avoid this problem ?
>
> It's hard to tell from the information you have supplied. What is the return type of your function? Are you returning a reference to stack-allocated storage?

I'm simply performation the affectation of the std::string result of the function call into another std::string locally declared variable.

Ok thanks for trying to help. Which project settings are important ? What does the preprocessor definition POCO_DLL imply ? Should I define it when compiling the libraies ? Should I define it when compiling the code linking with the libraries ?

> Which project settings are important ? What does the preprocessor definition POCO_DLL imply ? Should I define it when compiling the libraies ? Should I define it when compiling the code linking with the libraries ?

POCO_DLL is a preprocessor definition that determines whether a library is built as dynamic (aka shared) library. POCO_STATIC, when defined, causes it to be built as static library. If none of the above is defined, POCO_DLL is used, defaulting to dynamic library.

Look into your compiler and linker command lines for the application and the library, those will tell you exactly what you are doing.