I faced a scenario in which I required to export/import (from/to a DLL) a structure pointer variable declared as NULL in a .cxx file.
static Notify_struct *ptr_name = NULL;
Now since it a .cxx file I can't use my Export/Import API, because in-case this file is read undet dllimport it will report compilation error as 'definition of dllimport not allowed'.
So, I moved declared this variable to a header file like this:
extern DLLEXPORTIMPORTAPI Notify_struct *ptr_name ;
This made the DLL to export this variable easily.
Few points to make. I cannot write in the header file:
EXPORTIMPORTAPI static Notification_db *notification_db;
as it reports ‘error C2201: must have external linkage’.
No comments:
Post a Comment