If you want to use an exported symbol, you will need to add an "import" (IMPORT_ATTRIBUTE) decoration to the function/data member for use within your project. Typically most public API functions and global/static data members are already pre-decorated for your use within an appropriate header file (.h or .fdf) that you simply include in your project and then proceed to call or use. BENTLEYDLL_EXPORT may be a better way of thinking that you want "to use an export" vs. IMPORT_ATTRIBUTE that may or may not be as intuitive. You can modify your sample to work adding the hilighted:
extern "C"
{
#if !defined (mdl)
BENTLEYDLL_EXPORT extern wchar_t* ustnTaskId;
#endif
} // extern "C"
Or, modify using the macros below which may help improve readability:
BEGIN_EXTERN_C BENTLEYDLL_EXPORT extern WCharCP ustnTaskId; END_EXTERN_C
Headers of interest for these macros are:
Bentley\Bentley.h:64: #define IMPORT_ATTRIBUTE __declspec(dllimport)
Bentley\Bentley.h:157: #define BEGIN_EXTERN_C extern "C" {
Bentley\Bentley.h:158: #define END_EXTERN_C }
Bentley\Bentley.h:242: #define BENTLEYDLL_EXPORT IMPORT_ATTRIBUTE
HTH,
Bob