gj_williams2000@yahoo.co. Guest
|
Posted: Wed Aug 03, 2005 8:38 am Post subject: Writing a dll containing inherited classes |
|
|
Hello,
Can you expose a class from within a dll to an application if it is
inherited from other classes in the dll?
I recently wrote an object oriented OpenGL graphics engine and I'm now
trying to turn it into a dll so that I can tidy all the code away and
just show the programmer using my enigine what they need to see. I also
want to make the code usable in any language you write a header file
for.
But it doesn't work! I have been fiddling about with it for a while now
and I have narrowed the problem down.
You can create the engine object ok but when you call its methods it
either (using register calling convention) does sod all or (using
stdcall/cdecl/pascal) it crashes with an exception.
Here are some snippets:
type TglAbstract = class(TObject)
....
end;
type TglObject = class(TglAbstract)
......
end;
type TglEngine = class(TglObject)
....
public
procedure Update(); virtual; stdcall;
.....
end;
Calling Update will crash the application but if I comment out the code
so that the engine isn't inherited from TglObject then I can call the
Update method ok
Is there any way I can inherit form TglObject and still put the code in
a dll?
Thanks
Gareth
|
|