Archived

This topic is now archived and is closed to further replies.

Spacecat

Run-Time Library questions.

Recommended Posts

Spacecat    122
I''ve been reading Sobeit Void''s excellent article about making solid LIBs, writing LIBs plus an article on the subject... And suddenly I had an interesting question thrown at me by a work pal: There are six possible run-time libraries in C++, okay. Libraries and DLLs should use the same run-time library as the main project using them, okay. Question #1: Windows involves a whole shebang of DLLs, are they all available in those six versions? I don''t picture all programs using the correct name mangling to statically link to the right DLL. How is this issue addressed?!? Question #2: I''ve noticed VC++ 6.0 to automatically pick ''Multi-Threaded'' as its run-time library when making a DLL. I am working on a single-threaded program that uses a statically-linked DLL. Is it safe to use a DLL that''s single-threaded??? (It is built with the project, it''s not a system nor shared DLL) =^.^= Leaders and teachers should remember: It is best to offer others what they Need, not what they Want.

Share this post


Link to post
Share on other sites
S1CA    1418
Answer #1:
- DLLs aren''t ever statically linked.

- When you''re building an app or DLL which makes use of something in a DLL you statically link with an **export library** which is a .lib file that contains the full name of the DLL and mapping for any name mangling that may be required to access functions in that DLL.

Answer #2:
Yes, it''s safe. The main reason for matching the version of the CRT being used is because some structures such as those being used by the memory allocator have slightly different sizes and layouts between the different CRT versions.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Spacecat    122
Thanks...

So DLLs being rather encased means that a well-made single-threaded DLL might actually be called safely by a program that uses the multithreaded CRT. (Well-made = all memory allocations remain inside the DLL or inside the EXE, no sharing) Am I right?

I also remember that DLLs tend to use memory in a peculiar manner as compared to the calling EXE. Where might I find information about that, might I ask?

(I know MSDN would be a good guess, but it is so -massive- I don''t know where to look in MSDN. )

Share this post


Link to post
Share on other sites