Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Delphi XE8: What happened to TSafeArray and PSafeArray?


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Jun 15, 2015 6:27 PM Last Post By: Kevan Chapman
Kevan Chapman

Posts: 4
Registered: 12/1/99
Delphi XE8: What happened to TSafeArray and PSafeArray?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 15, 2015 5:09 PM
I am working with a type library that uses PSafeArray extensively in the early-binding IDispatch functions. My last Delphi version was XE2, and I was able to use the imported type library fine in my Delphi apps.

Now I have Delphi XE8, and as far as I can tell, SafeArray, PSafeArray, TSafeArray and tagSafeArray are no longer defined. SafeArrayCreate now generates a PVarArray result instead of a PSafeArray result. When I try to use PVarArray instead of PSafeArray in my code, it complains about incompatible types:
E2033 Types of actual and formal var parameters must be identical.

When did this change, and how do I get past it?

Will replacing the PSafeArray references in the _TLB.pas file with PVarArray work? Perhaps I need to re-import the type library with different command-line parameters?

Here is the original function definition in the VS2010 ODL file used to generate the type library:
[id(11)] HRESULT GetFacetPointIndices( [in] int iFacetIndex, [in, out] SAFEARRAY(int)* pIndArray, [out, retval] int* numIndices );

Here are the imported function definition in the TLB:
from the IDispatch table:
function GetFacetPointIndices(iFacetIndex: SYSINT; var pIndArray: PSafeArray): SYSINT; safecall;
and from the DispInterface table:
function GetFacetPointIndices(iFacetIndex: SYSINT; var pIndArray: {NOT_OLEAUTO(PSafeArray)}OleVariant): SYSINT; dispid 11;

Thanks for any insight.
--
You never know until you find out.

Kevan Chapman

Posts: 4
Registered: 12/1/99
Re: Delphi XE8: What happened to TSafeArray and PSafeArray?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 15, 2015 6:27 PM   in response to: Kevan Chapman in response to: Kevan Chapman
Never mind. Just needed to include the ActiveX unit. It doesn't seem to be referenced anywhere in the docs, but apparently it still exists.

--
You never know until you find out.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02