DLL problem
by William Finlayson · in Technical Issues · 07/25/2001 (9:39 am) · 1 replies
I have a problem linking to classes inside DLL's.
I know how to dynamically link to functions inside DLL's, but I don't know how to do it with classes. Say I have a class:
class Whatever
{
public:
void Open();
void Close();
}
and say I write out it's methods in the DLL. I can compile it, but I don't know how to use the class in the dll from another program. I saw soemthing about vtables somewhere, and tried an example but it didnt work. I can make a function in the dll that creates an instance of Whatever, and returns a pointer to it, and I can use that function. But if I try to do anything with the object ie. WhateverInstance->Open(), I get an error and the prog crashes.
Sorry this is a bit rushed but I need to go. Any help would be much appreciated, I've been stuck on this for days :)
I know how to dynamically link to functions inside DLL's, but I don't know how to do it with classes. Say I have a class:
class Whatever
{
public:
void Open();
void Close();
}
and say I write out it's methods in the DLL. I can compile it, but I don't know how to use the class in the dll from another program. I saw soemthing about vtables somewhere, and tried an example but it didnt work. I can make a function in the dll that creates an instance of Whatever, and returns a pointer to it, and I can use that function. But if I try to do anything with the object ie. WhateverInstance->Open(), I get an error and the prog crashes.
Sorry this is a bit rushed but I need to go. Any help would be much appreciated, I've been stuck on this for days :)
About the author
Torque Owner Rick Overman
--Rick