comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Interfacing IDL and COM objects
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Interfacing IDL and COM objects [message #79925] Fri, 13 April 2012 13:56 Go to next message
Jim  Pendleton is currently offline  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?
Re: Interfacing IDL and COM objects [message #80146 is a reply to message #79925] Thu, 26 April 2012 11:21 Go to previous message
rohit bhat is currently offline  rohit bhat
Messages: 4
Registered: August 2011
Junior Member
On Apr 13, 4:56 pm, jimmyleependle...@gmail.com wrote:
> On Friday, April 13, 2012 8:15:57 AM UTC-6,rohitbhatwrote:
>> 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?- Hide quoted text -
>
> - Show quoted text -

Jimmy,

Thanks for your reply. I tried sending a Byte array but it comes back
empty.
The funny part is even when I pass the first argument in IDL (which is
declared as an Int on the COM side), as a long, ulong, int, uint,
float, string, (anything)...it does not crash or give any error.
Does it mean that IDL or COM are not able to understand each-other
here?

( The first argument will always be less than a number I get from a
previous operation. Suppose a database has two employees and I query
through IDL-COM. Then, nIndex (first arguemnt) should be 0 or 1 in the
procedure
GetInfo( Int nIndex, BSTR _RPC_FAR *pInfo )
So, If I input anything more than that, even then it doesnt work. or
doesnt crash)

Thanks,
Rohit
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: printf function meaning and applications?
Next Topic: Coyote Graphics Update: cgHistoplot

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:42:27 PDT 2025

Total time taken to generate the page: 0.00959 seconds