|
Naively, all kind of DLLs (registered and unregistered ones) are loaded in memory by the OS loader when a process needs to get linked with.
Standard DLLs (such as User32.dll ) don't need registration, registration is required only by COM DLLs.
Hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: Hope that helps.
CPallini, yes it does help, thank you very much. But the other thing is after the function call will the dll still reside in memory? (Registered and those who don't need registration)
Thanx for your reply.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
Programm3r wrote: But the other thing is after the function call will the dll still reside in memory? (Registered and those who don't need registration)
Which function call ?
In fact, you have two ways to load your dll. Either explicitely (by using LoadLibrary) or implicitely (you link to a library provided with the dll that contains information about how to load the dll's).
In the first case, the Dll is loaded when you call LoadLibrary and is released when you call FreeLibrary (if there is no other application that uses it). Or it is released when your application exits.
In the second case, the dll is loaded when your application is started an is released when your application terminates.
|
|
|
|
|
Cedric Moonen wrote: Which function call ?
Thanx Cédric, you have already answered my question in your thread.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
Registration of a DLL has nothing to do with when the DLL is loaded into the address space of the process that uses the DLL. Registration of a DLL is only needed if the DLL exposes a function called DllRegisterServer which usually is only applicable for COM DLLs.
Read more about DLL loading here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thank you very much Roger.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
Programm3r wrote: But the other thing is after the function call will the dll still reside in memory?
Oh YES, of course...
The OS loader may discard the DLL if the process detaches from. For an ordinary DLL, if the process implicitely links with (e.g. you have used the DLL's *.lib as input for the LINKER; this is the most common way...) the detaching happens on process termination; on the other hand, if the process explicitely links with (via LoadLibrary call), then the process can, at any time, discard the library by means of the corrensponding FreeLibrary call.
COM uses a completely different approach, a component DLL may be discarded by the COM when the component it's no more needed, i.e. when the reference count of the component reaches 0 (see life cycle of COM components in MSDN, however, basically, calling Release() on a COM pointer, allows COM to discard the related DLL).
Hope that helps
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thank sfor your help CPallini, really appreciate it.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
you're welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Now tell me an MFCxx.dll is a COM dll or a standard DLL?
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
VuNic wrote: Now tell me an MFCxx.dll is a COM dll or a standard DLL?
none. you have to provide it with your application binary, or place it in the path...
|
|
|
|
|
That's what a standard win32 dll dear.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
VuNic wrote:
That's what a standard win32 dll dear.
he he he
|
|
|
|
|
Hello comunity,
i try to save a struct variables to a map!
Simple struct with some CStrings as member!
Which one(Map) to use for that: CMapStringToOb, CMapStringToPtr, CMapWordToPtr?
regards
break;
|
|
|
|
|
in the context of MFC, I would use CMapStringToPtr or CMapWordToPtr depending on the key.
but I strongly suggest you start using STL and std::map.
|
|
|
|
|
Maximilien wrote: I strongly suggest you start using STL and std::map
I second that.
MFC also has a template version called CMap which works similar to std::map . Haven't tried it though since I prefer the STL version.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I thought CMap used a hash table and thus was similar to the non-standard hash_map as opposed to std::map.
std::map does not (as far as I know) provide constant average lookup times where CMap does. This would, in my opinion, indicate that std::map is not a good substitute (as far as performance is concerned) for CMap.
This is the main reason I still use CMap, at least until the new "standard" version of hash_map finally gets fully approved.
Maybe I'm missing something so correct me if that's incorrect
|
|
|
|
|
Regarding the performance issue you're probably right, but I cannot verify this since, like I said, I haven't used CMap very much. Whether this performance boost is necessary or not would depend on how the map is used and how frequently elements have to be looked up.
I prefer the STL version due to portability reasons, CMap only exists in MFC library.
If I e.g. develop software in C++ aimed for an embedded system I wouldn't find CMap in that environment. So if I know how to use the STL library I can write more portable code.
If the std::map implementation becomes a performance issue I will first re-evaluate my design and if I find the design to be allright I probably will write my own mapping container using a hash table or similar.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: So if I know how to use the STL library I can write more portable code
Fair enough. I would agree that the portability issue is a big one. I hesitated to use hash_map only because of all the warnings about each library implementing slightly different variations of it and the fact that the "standard" extension for it will likely be of a different name. I'd hate to learn a specific library only to have to change once again when the standard was ratified.
I'm stuck in a windows only OS environment so the MFC's portability issues have been non-existent but I keep forgetting that's not the case for everyone.
Anyway, I'm constantly struggling to understand it all and I posted the comment out of fear that I may have missed something between std::map, hash_map, and CMap. My main concern was the comparison between std::map and CMap since, as far as I know, std::map does not use a hashing table and thus the similarities are not enough to consider one a direct replacement for the other. CMap and hash_map appear, at first glance, to be closer.
One of these years this stuff may all finally make some sense to me.
|
|
|
|
|
Depends on what you are associating with the struct... If you are mapping a string to the struct, you can use CMapStringToPtr or CMapStringToOb , depending on how your struct is/was designed.
Note that using the STL version of the map class would likely be a better idea, but while I like the STL's string class, doing a wholesale replacement of CString may or may not be possible depending on your codebase.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hi all,
I have a question regarding running VC6 programs on Vista. My program is having problem (certain API won't work) with the MSVCRT.DLL provided by Vista in System32 folder. I have tried the side-by-side way to place my own (older version of MSVCRT.DLL) under my application directory and provide a manifest file for that. It works under Windows XP.
However, when i move the files to Vista, Vista still used the System32/MSVCRT.DLL and ignored my manifest, and thus ignore the older MSVCRT.DLL. I wonder if someone has experienced the same. I have heard that Vista always use the MSVCRT.DLL from System32 for security reason.
Does someone know how to override it? If not, then I may have to recompile my old programs for Vista.
Thanks for helping.
Benny Levin
|
|
|
|
|
If that really is a security feature, then one of two things is up:
The functionality you are trying to use is not being used correctly or is undocumented, and just used to work before things were fixed/changed -or-
There is a bug in the MSVCRT.DLL provided in Vista.
All things being equal - I would presume the former, no offense intended, otherwise Vista would not be backward compatible and that is a rather stupid thing to do.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hello,
When I use the insert function in vector from STL the pointer becomes invalid from the point where it was inserted.
So how do I use the next elements from the vector
Prithaa
|
|
|
|
|
please show how you're doing thing ?
|
|
|
|
|
Hello,
class CRICH
{
};
vector<CRICH*>m_table;
CRICH *CRICHobj = new CRICH;
m_table.insert(&m_table[2],1,CRICHobj);
Now the pointers after 2 become invalid if I already have vector of about 10 elements of CRICH*
Prithaa
|
|
|
|