lexicon
June 22nd, 2008, 05:06 PM
Hello;
I am trying to understand the concept of "Explicit Linking" but the following code gives the error error C2365: 'GetLogicalDrives' : redefinition; previous definition was 'function'
Other API functions such as FindFirstVolume, FindNextVolume, FindVolumeClose etc works properly.
Any ideas ?
#include <windows.h>
#include <stdio.h>
DWORD (WINAPI *GetLogicalDrives) (VOID);
int main()
{
// Load the dll
HMODULE hmod;
if((hmod = LoadLibrary(TEXT("Kernel32.dll"))))
{
if((GetLogicalDrives = (DWORD (WINAPI*)(VOID))GetProcAddress(hmod,"GetLogicalDrives")))
{
DWORD drivesId = GetLogicalDrives();
}
}
return 0;
}
I am trying to understand the concept of "Explicit Linking" but the following code gives the error error C2365: 'GetLogicalDrives' : redefinition; previous definition was 'function'
Other API functions such as FindFirstVolume, FindNextVolume, FindVolumeClose etc works properly.
Any ideas ?
#include <windows.h>
#include <stdio.h>
DWORD (WINAPI *GetLogicalDrives) (VOID);
int main()
{
// Load the dll
HMODULE hmod;
if((hmod = LoadLibrary(TEXT("Kernel32.dll"))))
{
if((GetLogicalDrives = (DWORD (WINAPI*)(VOID))GetProcAddress(hmod,"GetLogicalDrives")))
{
DWORD drivesId = GetLogicalDrives();
}
}
return 0;
}