Knowledge Base |

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

Article ID: 109338

Article Last Modified on 5/6/2003

APPLIES TO

- Microsoft Access 1.0 Standard Edition
- Microsoft Access 1.1 Standard Edition
- Microsoft Access 2.0 Standard Edition

This article was previously published under Q109338

## 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: kbhowto kbprogramming KB109338