Description
How do you properly define functions that are DLL entry points for Connect on Windows? These are the functions that Connect calls as the initialization functions for User-defined Data Types (UDTs) and Adapters (including the LegacyPlug Adapter) and the procedures for the Application Connector (Procedure Driver).

Solution

When writing a function that is an entry point for a DLL that Connect will call the function must have the following attributes:

1. It must be a cdecl function. In C/C++ you specify this with the function qualifier: __declspec(dllexport).

2. It must be a C function. So when written in C++ the function needs the qualifier: extern "C". This is in addition to the cdecl function qualifier in (1) above.


After creating the DLL the DLL can be put in any desired directory. If it is in %NAVROOT%\bin, %SYSTEMROOT%\system32, or a directory contained in %PATH% then you can refer to it in the Connect meta data with just the basename (for adapters and data types in addon.def as the value of the SHAREABLE-NAME attribute or for procedures in the XML meta data file as the value of the filename attribute). If it is in another directory then you are required to specify the DLL with the fully qualified filename, e.g., c:\directory\subdirectory\dllname.dll.