Exporting object in DLLs
hi Forum,
I know how to create DLLs but I was wondering how I would go about exporting objects and variables in a dll to the main applications. I know that when u have a function in a dll to be used in the main app, you write something like this before the function signature:
__declspec(dllexport) void DoSomething()
{
//do something...
}
is this the same with the objects and variables u wanna export?
If so, would I write this in the header file or cpp file or both?
Thanks in advance
DarkStar
UK
class __declspec(dllexport\import) TypeName
{
...
};
All static members should be declared export in the cpp files used to compile the DLL.
That is microsoft specific. I don't know about other windows compilers.
{
...
};
All static members should be declared export in the cpp files used to compile the DLL.
That is microsoft specific. I don't know about other windows compilers.
Also make sure you put the __declaspec(dllexport) on the inner classes/structs. And the variables need a "extern __declaspec(dllexport)" in their declaration ... usually.
Quote:Original post by Clash
All static members should be declared export in the cpp files used to compile the DLL.
I've never had to do declare static members with export...
If you want the values of the static members available to the debugger, I've found that exporting them makes that happen. Not to mention, the Microsoft C++ compilers gives warnings when they are not exported.
Hello,
These articles can be very useful:
Adding Plug-ins To Your Application
Tutorial - Creating And Using DLLs
Using Interfaces with Dlls
These articles can be very useful:
Adding Plug-ins To Your Application
Tutorial - Creating And Using DLLs
Using Interfaces with Dlls
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement