Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetDllDirectory() isn't recognized!?!?

Status
Not open for further replies.

cpjust

Programmer
Sep 23, 2003
2,132
0
0
US
I hate it when Visual Studio does this to me...
I'm trying to use GetDllDirectory() in my MFC DLL app.

I have this code in my function:
Code:
char dllDir[MAX_PATH];
DWORD ret = GetDllDirectoryA( (DWORD)MAX_PATH, (LPSTR)dllDir );
When I compile it, I get this compile error:
Code:
error C3861: 'GetDllDirectoryA': identifier not found, even with argument-dependent lookup
I added the SDK include and lib directories to my project settings.
I tried including <windows.h> and even <winbase.h> but no luck.

If I add this function declaration to my code (copied from <winbase.h>:
Code:
WINBASEAPI
DWORD
WINAPI
GetDllDirectoryA(
    IN DWORD nBufferLength,
    OUT LPSTR lpBuffer
    );
I get this link error:
Code:
error LNK2019: unresolved external symbol "__declspec(dllimport) unsigned long __stdcall GetDllDirectoryA(unsigned long,char *)"

If I try using the GetCurrentDirectory() function right above it in <winbase.h> it compiles and links with no problem.

Why does Visual Studio hate me? :-(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top