Because I'm not entirely sure on how interfaces work in Delphi. I could probably use interfaces and just add stuff like AddRef() and Release() to the C++ class but since I'm not sure how it would work I don't want to use it.Originally Posted by cairnswm
In the C++ code. I can just use CMySub *MyClass = new CMySub(). And then send the returned pointer to Delphi.Originally Posted by cairnswm
I guess this is more or less what's the problem. My guess is that the Virtual Method Table indexes are different in Delphi and FreePascal. (I can't really explain what the VMT is since I'm not entirely sure myself, but think of it as an array of method pointers where all the TObject methods has a negative index. That way a C++ class, with it methods starting at 0, can be called without problems. If these have a positive index in FreePascal MyClass.DoSomething() will point to something irrelevant live MyClass.Create()).Originally Posted by {MSX}
As for not using something like MyClass_DoSomething(). Well, that could probably work (and if I can't come up with some other solution I'll probably use it). However it's not as clean, especially when I have some code like IMyClass.Add(): IMyOtherClass and IMyClass.Find(AName: PChar), then it can be a hell to use...
As for using C++ classes in Delphi I used this article.
[edit] Seems like I don't really know how to use URLs... :?
Bookmarks