Click here to Skip to main content
       

C / C++ / MFC

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
Questionhow to call a dll indipendent of path where it located in a system? [modified]memberlitu kumar6 Nov '12 - 0:52 
Hi,
I have created a COM dll . I'm calling another dll(C#.net dll\assembly)by adding refrence of this .net dll(from project properties) .And i able to access properly.
 
Now i want to make this .net dll usage should be independent of path. I mean -
 
I'll not add any reference or give path name in my COM dll Hence my COM dll don't know where this .net dll is located in the system. While COM Dll try to call this .net dll it'll search in whole system & load it.
 
Kindly please advice the C++ code for this
 
OR LoadLibrary() is only the method through that only we can load library dynamically(independent of path)
 
Please advice . Thanks in advance Smile | :)

modified 6 Nov '12 - 8:05.

AnswerRe: how to call a dll indipendent of path where it located in a system?memberjschell6 Nov '12 - 9:13 
litu kumar wrote:
it'll search in whole system

 
That is unlikely to be a good idea.
 
Have you tried to write code that searches for one dll on the system?
What if there are two different versions?
What if there are mapped network drives?
GeneralRe: how to call a dll indipendent of path where it located in a system? [modified]memberlitu kumar6 Nov '12 - 18:02 
Hi jschell,
 
You are right - its not a good idea.
 
We don't want to give specific location of dependent Dll in COM code . Because this dependent DLL is not developed by us. This dll usually obtained after installation of a software.
we legally tied-off with this software company & code cann't be provided them(as usual company policy)
Hence if it is possible then we want to load dynamically.
 
I'm guessing if we do search the dependent dll in whole system while invoking ,there may be the performance issue may happen. But still the requirement is like this.
 
Hope you understood our requirement.
Hence if any best ways kindly please suggest.

modified 7 Nov '12 - 0:10.

GeneralRe: how to call a dll indipendent of path where it located in a system?memberjschell7 Nov '12 - 7:51 
So you want to detect if it is installed.
 
Normal installations will create a registry entry which you can look for. You find the entry and grab the install directory. Then...
 
During your install.
1. Present a dialog to the user with the default product path (or the found one above.)
2. The user can modify the path.
3. When the user says ok you then verify that the correct dll is at the path specified.
4. If the dll (and correct version) is not found then put out an error message and go back to step 1.
QuestionVery happy with C++11member_Josh_5 Nov '12 - 16:33 
I've been using the auto keyword, lambdas and move constructors so far and all seems very cool. If the only thing they added was the auto keyword it would still be worth upgrading. This is just awesome...
 
auto it = someCollection.begin();
 
...but of course the downside is we now need cbegin() as well
AnswerRe: Very happy with C++11memberSarath C5 Nov '12 - 19:01 
This might help in lot of cases, but I really wonder if C++ 11 can reduce the pain of memory mangement. In my experience, auto variables are hardly I needed for my development. but really got tired of several gotchas and memory corruption and management with C++
-Sarath.
My blog - iSpeak code
Rate the answers and close your posts if it's answered

AnswerRe: Very happy with C++11mvpRichard MacCutchan5 Nov '12 - 22:25 
_Josh_ wrote:
auto it = someCollection.begin();
[puts on curmudgeonly old git voice] A total abomination which will lead to lazy programmers (as if there weren't enough already), and unreadable code.
One of these days I'm going to think of a really clever signature.

GeneralRe: Very happy with C++11memberJoe Woodbury6 Nov '12 - 7:32 
Don't get me started. Today's object spaghetti makes the old C spaghetti pale in comparison.
 
C++11 advocate: Look, I made the code more awesome.
Me: It's slower, more complicated than it needs to be and much harder to find bugs. Why not just use C#?
C++11 advocate: But, it's more awesome!
 
(I actually heard someone today advocate that all pointers must be wrapped in shared_ptr, no matter what. I'm even working on some code that did that for absolutely no apparent reason--the delete happens within three lines and there is a catch around the call to which the pointer is passed AND the pointer is not actually shared. Yet, they not only used a shared_ptr, but spent time creating a factory to instantiate the only instantiation ever of the object to which the pointer is passed.)
GeneralRe: Very happy with C++11member_Josh_6 Nov '12 - 8:50 
But the variable is still typed. There is not much in c++ that can't be abused. I think used well auto will make life better.
GeneralRe: Very happy with C++11mvpRichard MacCutchan6 Nov '12 - 21:27 
_Josh_ wrote:
I think used well auto will make life better.
I don't see how writing auto rather than a type will make life better.
One of these days I'm going to think of a really clever signature.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid