hey,
I am programming an ansi C application that needs to load a .dll.
My line of code is the next:
hCodigo = LoadLibrary("zlib1.dll");
when I try to run the program that way it doesnt find the dll, I started searching and find that exists LoadLibraryA, the program works using that function,
but why it doesnt work with LoadLibrary("dll")??
also, are there any differences in those functions?
I know that the last A is for Ansi, this is the only i found about LoadLibrary, hehe.
Btw, I read somewhere that i should use _T("dll") but that didnt work.
the dll is in both folders system and system32.
Thanks,
65dos
Beware though, LoadLibrary can expand to either LoadLibraryA or LoadLibraryW depending on the UNICODE settings, but GetProcAddress() always takes a ANSI string (char *) for some weird resason.
It's rare that you should ever explicitly call A or W versions of the api's. Just use the _T("") macros and let the compiler and environment do its job.
well, it compiles but the compiler sends an incompatible type warning:
char[10] is incompatible to type LPCWSTR.
but when I used 'L' on LoadLibrary( L"zlib1.dll") it removed the warning.
on unicode it calls LoadLibraryW
while multibyte calls LoadLibraryA
good to know these things know hehe
Ignoring compiler warnings is always a good way to get stable code.
Asking in a forum about a function not working even though your compiler gave you a warning about it and then not even bothering to mention on the forum you're getting that compiler warning... Tsk...
Bookmarks