2
votes

I am primarily a C++Builder these days and have built (for my own use) a powerful and useful set of classes which wrap around a 3rd party database application. I have a client who uses Delphi. I would like to create a package/active X object/DLL/something exposing some components or classes he could use in Delphi to leverage my code. I'm using XE2 and he is up to date (XE5?). I can update if its helpful. The database in question stores numeric data in time series - so I'm moving around large arrays mostly.

Whats the best strategy for that? I can, of course, build a DLL with C style exported functions, but I'm wondering if there are any cool Embarcadero-ey tools I can use to make it more elegant. I know that components written in C++Builder can't be used in Delphi, but what about packages? The documentation is vague.

I'm having trouble finding information about this topic because all searches on Delphi/C++Builder inter-operability assume the other direction.

1
AFAICT, it's not possible to use Builder classes (whether components or not) in Delphi. The Builder object model is totally different than the one used in Delphi, and there was never a Delphi wrapper for it. (I'm not sure there could be, as C++ supports features like multiple inheritance that Delphi doesn't.) The problem you're having finding info is probably because it can't be done. ActiveX would be the only viable alternative I could think of, other than a DLL which provides a flat wrapper. Rudy Velthuis (should be able to find via Google) wrote a couple of articles about this on his site.Ken White
Thanks, that is very helpful. It would seem that Interfaces are the way to go.marcp
@KenWhite, shouldn't that (in slightly longer form) be an answer?Johan
Johan: I thought about that, but I'm not a huge Builder person, and figured @RemyLebeau would be along and find this, and could probably post a better (technical) answer. If no one does answer, I'll convert mine into one. :-)Ken White

1 Answers

2
votes

AFAICT, it's not possible to use Builder classes directly (whether components or not) in Delphi.

The Builder object model is somewhat different from the one used in Delphi, and there was never a Delphi wrapper for it. (I'm not sure there could be, as C++ supports features like multiple inheritance that Delphi doesn't.)

The problem you're having finding info is probably because it can't be done. ActiveX would be the only viable alternative I could think of, other than a DLL which provides a flat wrapper. Rudy Velthuis (a member of TeamB who also participates here at SO) wrote an article about this, where he demonstrates both techniques - the flat wrapper and a COM interface - as well as a good explanation of how to apply the techniques. You can find his post here.