Click here to Skip to main content
13,046,176 members (93,611 online)
Rate this:
Please Sign up or sign in to vote.
I am having a bin folder in where my application.exe resides. My program uses, two dll with same name that has different exposed functions. I will be able to put only one dll in my bin directory. Renaming other DLL is not working. Any Suggestion on this scenario ?
Posted 25-Oct-12 6:44am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You also need to rename its associated .lib file when you build your project. If these are your own .dlls, then it would be better to rebuild one of them with a completely different name. Alternatively you could use the LoadLibrary()[^] function to load one of them and handle all function calls dynamically.
gssajith87 25-Oct-12 13:42pm
Thanks for the response.
Yes, I tried using LoadLibrary(). Now the problem is , when we specify the full path of the dll in the LoadLibrary Function, we get a error saying, Path Not Found. Any Suggestion on this.
Richard MacCutchan 25-Oct-12 13:43pm
Yes, your path is incorrect, as the message tells you. Show us the actual code you use, otherwise we cannot guess what you are doing wrong.
gssajith87 25-Oct-12 13:56pm
Here is the code :

wchar_t wbuf[PATH_MAX];
flags = 0; // Unused
to_unicode("D:\\php\\ssleay32.dl", wbuf, ARRAY_SIZE(wbuf));
return LoadLibraryW(wbuf);
Sergey Alexandrovich Kryukov 25-Oct-12 15:09pm
There are no situations where hard-coded path names can be useful. All the path names should be calculated during run time, based on executable directory (most adequate in this case; don't mix it up with current, or working directory which can be changed by the user to anything at all), "special folder" (per user profile of for "all users"), some configuration data, etc.
Richard MacCutchan 26-Oct-12 4:00am
Very true.
Richard MacCutchan 26-Oct-12 3:58am
I assume that the extension .dl above is a typo and your actual path has the correct extension. Also, you are not checking the response from the LoadLibraryW() call, so you do not know for sure what is happening. And why are you using a function to convert a static string to Unicode rather than using the L compiler prefix on the string?
gssajith87 25-Oct-12 13:57pm
The Path exist
gssajith87 25-Oct-12 14:20pm
Hi Richard,

I Tried using the similar dll from my 64 bit compilation and got it worked ! When i tried to use the same in 32 bit dll, it fails, DLL opened using dependecy walker to show if it is 32 bit dll and it was!
CPallini 25-Oct-12 15:17pm
My 5.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Thanks for the response. We concluded to use, static library for one and dll for the other, that had no conflict.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 31 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100