PRB: Error 2001 Linking Simple MAPI Applications (188959)
The information in this article applies to:
- Simple Messaging Application Programming Interface (MAPI)
This article was previously published under Q188959 SYMPTOMS
When linking a compiled Simple Messaging Application Programming Interface
(MAPI) application, you may get the following error for many of the Simple
MAPI function calls that you make in your application:
Error LNK2001: unresolved external symbol.
CAUSE
The most common cause of this error is the omission of the LoadLibrary
and/or GetProcAddress functions. Each of the Simple MAPI functions must be
loaded into memory and referenced by a function pointer.
RESOLUTION
The following code fragments shows how to load and get the address of the
MAPILogon function:
LHANDLE m_lhSession;
HINSTANCE hlibMAPI = LoadLibrary ( "MAPI32.DLL" );
LPMAPILOGON m_MAPILogon = (LPMAPILOGON)GetProcAddress(hlibMAPI,
"MAPILogon");
// Call the function through the function pointer.
m_MAPILogon ( 0L, // Handle to parent window or 0.
"", // Default profile name to use for MAPI session.
"", // Profile password for MAPI session.
0L, // Various session settings. Can be 0
0L, // Reserved. Must be 0L.
&m_lhSession ); // Handle to Simple MAPI session. MORE INFORMATION
All Simple MAPI applications must get the address space of all the Simple
MAPI functions it uses in advance. Any Simple MAPI application also needs
to include the Mapi.h file from the Microsoft Platform Software Development
Kit (SDK).
Do not statically link the Mapi32.lib or the Mapi.lib library files into
any Simple MAPI project. Linking with the static MAPI libraries for Simple
MAPI applications is not supported.
Modification Type: | Minor | Last Reviewed: | 8/18/2005 |
---|
Keywords: | kbcode kbprb KB188959 kbAudDeveloper |
---|
|