Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ VS2010 DLL
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 7:44am
Rate this: bad
good
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.
  Permalink  
Comments
gssajith87 at 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 at 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 at 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 at 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.
--SA
Richard MacCutchan at 26-Oct-12 4:00am
   
Very true.
Richard MacCutchan at 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 at 25-Oct-12 13:57pm
   
The Path exist
gssajith87 at 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 at 25-Oct-12 15:17pm
   
My 5.
Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 BillWoodruff 360
1 Mathew Soji 309
2 DamithSL 225
3 Afzaal Ahmad Zeeshan 202
4 Maciej Los 190
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web04 | 2.8.1411019.1 | Last Updated 31 Oct 2012
Copyright © CodeProject, 1999-2014
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