I read several documents that give simple examples of functions compatible with C.
__declspec(dllexport) MyFunction();
I'm against it. I am writing a small application using the functions of this DLL. I used an explicit connection with
LoadLibrary()
function. C style functions work without problems. But when I write my class like
namespace DllTest
{
class Test
{
public:
__declspec(dllexport) Test();
__declspec(dllexport) void Function( int );
__declspec(dllexport) int getBar(void);
private:
int bar;
};
}
#endif
It compiles and is created by Dll. While working with C style functions, I simply used a pointer to the functions from the LoadLibrary () and GetProcAddress (...) functions.
My previous use
typedef void (*Function)(int);
int main()
{
Function _Function;
HINSTANCE hInstLibrary = LoadLibrary(TEXT("test.dll"));
if (hInstLibrary)
{
_Function = (Function)GetProcAddress(hInstLibrary,"Function");
if (_Function)
{
But now I have no idea how I can instantiate a class? How can I use explicit links or implicit links?
Any help with sample code would be appreciated.
source
share