Re: Interfacing IDL and COM objects [message #79925] |
Fri, 13 April 2012 13:56  |
Jim Pendleton
Messages: 165 Registered: November 2011
|
Senior Member |
|
|
On Friday, April 13, 2012 8:15:57 AM UTC-6, rohit bhat wrote:
> Hi,
>
> I was trying to interface Import a COM object into IDL. I have no
> knowledge of COM but I do have the source code with me.
> There are a few methods defined with the keywords [propput]. I used
> IDL's SetProperty method and it worked on them.
>
> Then there are few methods that have nothing defined in them . Eg:
> GetInfo( In nIndex, BSTR _RPC_FAR *pStudy_Info )
> where Study_Info is a structure that has fields like
> {
> int nIndex
> char Pname[128]
> char Date [32]
> int Status
> char Description[128]
> char ID[128]
> }
>
> When I call this method in IDL, using Obj -> GetInfo, 0l, S
> 1. Error when I put S as "structure", "pointer to a structure" on the
> IDL side
> 2. Nothing returned when S is a "string", "byte" on the IDL side
>
> Does the presence of keywords like [retval], [in] make it easier for
> IDL to interface with COM?
> or
> Is it that IDL does not understand the datatype that COM sends? (non-
> compatibility with structures, pointers, strings)
>
> Please let me know.
>
> Thanks,
> Rohit
Just a guess, but what if you specify the parameter, on the IDL side, as a BYTARR() of the correct number of bytes? If this works, you'll need to use IDL's FIX function on the returned byte vector to extract your data, via the offset parameter and TYPE keyword.
Be careful of the definition for char in this context. Is it really a 1-byte C-style char or is it multibyte or Unicode?
|
|
|