Solved

Is it possible to specify WINAPI when calling a function

Posted on 2011-02-12
2
330 Views
Last Modified: 2012-05-11
The following won't compile because GetProcAddress name clashs between the class and WINAPI. If I rename MY_ODBC_DriverMangerClass::GetProcAddress  then it works. Is there any way I can specify the WINAPI call within the body of the class function so I can keep the same function name? Any alternative suggestions?

class MY_ODBC_DriverMangerClass
{
      private:
            HINSTANCE DLLinstance;
      public:
            VOID LoadDriverManager() { DLLinstance = LoadLibrary(_T("odbc32.dll")); };
            FARPROC WINAPI GetProcAddress(__in  LPCSTR lpProcName) {return(GetProcAddress(DLLinstance,lpProcName));};
};
0
Comment
Question by:elcbruce
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
Comment Utility
Just use the scope resolution operator '::' to distinguish between the Windows API and your member function and that will compile fine:
class MY_ODBC_DriverMangerClass
{
      private:
            HINSTANCE DLLinstance;
      public:
            VOID LoadDriverManager() { DLLinstance = LoadLibrary(_T("odbc32.dll")); };
            FARPROC WINAPI GetProcAddress(__in  LPCSTR lpProcName) {return(::GetProcAddress(DLLinstance,lpProcName));};
};

Open in new window

0
 

Author Comment

by:elcbruce
Comment Utility
That worked, thanks.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now