In our previous episode, Dennis said:
> I have a windows 32-bit dll written in C++ (probably C++ Builder).
> It has 1 function which I need to call:
> 
> int SPAPI_GetProduct(vector<SPApiProduct>& apiProdList)
> 
> I am stuck at the keyword vector.

It is not a keyword it is a generic type. So that is not easy, specially
since C++ and Pascal classes differ.

And even if the call succeeds, getting results from apiprodlist is major
problem number two.

You can try to match the C++ code with carefully crafted pascal code, but
that requires knowledge about implementation details of the C++
implementaton.

I avoided that way (as too complicated and too fragile), but Rudy Velthuis
has an article on it (C++ <-> Delphi)
http://www.rvelthuis.de/articles/articles-cppobjs.html

I myself generally solve this with a wrapper DLL, by crafting a DLL in C++
that exports a C (not C++) interface, and then use that. The same method as
QT is used from Lazarus (via wrapper dll/.so qtpas)
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to