Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting functions from C DLL

Inter-Process Communication

Exporting functions from C DLL

by  chiph  Posted    (Edited  )
If you're writing a C DLL that you expect to be able to call from VB, you may be tempted to use the __declspec(dllexport) keyword. While this works fine for having other C functions call your DLL, VB is unable to find the exported functions. Instead, you should export your functions using a .DEF file.

The structure is pretty easy. You tell it you're writing a DLL, give it a name and description, and list the exported functions, with optionally a numeric ordinal.

[tt]
LIBRARY WhizzoDLL
DESCRIPTION "Implements a Whizzo operation."
EXPORTS
Insert @1
Delete @2
Search @3
Whizzo @4
[tt]

Add the .DEF file to your Visual C++ project and re-link. All should be fine.

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top