ACC: How to Declare C++ Functions Called from Access Basic

Last reviewed: June 8, 1997
Article ID: Q109338
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0

SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

The following steps describe how to call C++ dynamic-link library (DLL) functions in Access Basic:

  1. Make sure to define the functions within your C++ code with the "extern" declaration. The following example demonstrates the syntax for the extern declaration:

          extern "C" {return type} FAR PASCAL  __export {function name}
    
             ({parameters})
    
       An example of an actual declaration in your C++ code might look
       like:
    
          extern "C" int FAR PASCAL __export my_func ()
    
       To call the sample function above you would define the Declare
       statement as follows:
    
          Declare Function my_func Lib "MYLIB.DLL" () As Integer
    
    

  2. Make sure that the declaration is not set for case-sensitive exports.

REFERENCES

For more information about calling DLLs, search on "declare external procedures" using the Microsoft Access Help menu.


Additional query words: programming
Keywords : kbprg PgmApi
Version : 1.0 1.1 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 8, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.