Christian Mol

Hi,

I have an application that during runtime opens some dll files (plugins). One of these depends on a library that depends on msvcr80.dll and msvcp80.dll. When I load this dll into the debug version of my application I have both runtime libraries msvcr80.dll and msvcr80d.dll loaded, the same with msvcp. Can this lead to problems in my application Or is the vcr80 only linked to that dependent library

Regards,
Christian


Re: Visual C++ General Runtime libraries

Simple Samples

I am not sure I understand your question. I think an easy answer is that if compatible libraries are used consistently within the output of the linker, you will be safe. I am not sure of this, but I think it is true most of the time at least. If you did not develop the plugin, then I assume it was developed for general-pupose use in the manner you describe. If you do encounter a problem you can't solve, then post a question about that. When I say output of the linker, files with exe or dll extensions are usually created by the linker.




Re: Visual C++ General Runtime libraries

Christian Mol

Let me clearify the question a little Smile

I have an application which consists of x.exe and y.dll. Both are build by myself. However for y.dll to build I need to use a third party z.lib.

When I build the debug configuration of my solution (x.exe and y.dll) I see the following behaviour.
Before y.dll is loaded, the modules view shows only msvcp80d.dll and msvcr80d.dll (and some other) to be loaded. After loading y.dll in the application msvcp80.dll and msvcr80.dll appear in the modules view aswell. So now both the debug and release version of the runtime libraries are loaded.

During execution of the application a lot of problems arise in new and delete which I cannot explain. I was therefore wondering if having both runtime libraries loaded could cause these problems.


Regards




Re: Visual C++ General Runtime libraries

Shakje

What sort of problems

I'd of thought that would be ok, since the different modules in your program will only access the library that they were linked with.

What sort of problems with new/delete






Re: Visual C++ General Runtime libraries

Simple Samples

As far as I know, DLLs and the using exe can have different runtime libraries. Think of it this way. If we are required to have the same runtime library linking, then software would have to specify what linking they require. And if we use more than one libraries in an application, we could have an impossible combination of libraries.

If the problems with new and delete are the result of use of the library, then the documentation should explain how to avoid the problems. There are potential problems such as described in Potential Errors Passing CRT Objects Across DLL Boundaries, but as I say, if anything such as that applies, then the other software's documentation should say so.






Re: Visual C++ General Runtime libraries

Christian Mol

Thanks for that link, I think it might contain an answer for some of my problems

snip...
"A related problem can occur when you allocate memory (either explicitly with new or malloc, or implicitly with strdup, strstreambuf:Tongue Tiedtr, and so on) and then pass a pointer across a DLL boundary to be freed. This can cause a memory access violation or heap corruption if the DLL and its users use different copies of the CRT libraries."

So I cannot create an object in the dll and pass the pointer to my application that frees this object as I understand here. Should have an other approach there then.

Thanks,
Chris