Re: Conformant IDL array trouble
- From: "Alexander Nickolov" <agnickolov@xxxxxxxx>
- Date: Wed, 20 Sep 2006 09:56:49 -0700
_Never_ #import a type library containing interfaces that
are not Automation-compatible! Chances are some interface
is defined in a way that cannot be preserved in the type library.
Examples of such constructs are: local methods or local/call_as
pairs, local interfaces, methods with REFIID parameters. The
list is of course longer...
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
<cribface@xxxxxxxxx> wrote in message
news:1158759271.458465.201000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi!
I'm trying to send an array of structs (actually pointers to structs)
which themselves contains arrays of structs across process boundaries
(see IDL below). The problem is that only the first element of the
array (visRects) inside the struct (PageState) gets marshalled. The
other elements are garbage. I'm not trying to be automation compatible
and I've registered and built the proxy/stub for the interface. When
I'm using this interface I'm #importing the typelib and I've checked
that the generated header file contains #pragma pack(push, 4)/#pragma
pack(pop) wrapped around the struct definitions. I've read that the
lack these #pragmas could cause problems.
Any suggestions what could be causing this? Any help is very much
appreciated!
Here's my IDL:
import "oaidl.idl";
import "ocidl.idl";
[
uuid(DA64440E-2FF1-4E06-A43B-F908D4A5E3F3),
version(1.0)
]
library MyLib
{
importlib("stdole2.tlb");
[uuid(B42E70BF-F909-47bc-A221-69834A548C47)]
struct tagVisRect {
long left;
long top;
long right;
long bottom;
};
typedef struct tagVisRect VisRect;
[uuid(D86AAF38-6169-4aaf-8625-CCD5123D309B)]
struct tagPageState {
long startSec;
long startMicroSec;
long stopSec;
long stopMicroSec;
long x;
long y;
int visRectsSize;
[unique, size_is(visRectsSize)] struct tagVisRect *visRects; // Only
the first element in this array is valid!
};
typedef struct tagPageState PageState;
[uuid(36D8C2F8-FF02-4d42-A5FB-1EA8E1714CEF)]
interface IDatabaseProxy2 : IUnknown {
HRESULT SendPageStates([in, size_is(pageStatesSize)] PageState*
pageStates[], [in] long pageStatesSize);
};
};
Regards,
Christoffer
.
- Follow-Ups:
- Re: Conformant IDL array trouble
- From: cribface
- Re: Conformant IDL array trouble
- References:
- Conformant IDL array trouble
- From: cribface
- Conformant IDL array trouble
- Prev by Date: Re: Looking for COM class that has methods with output parameters
- Next by Date: Re: Looking for COM class that has methods with output parameters
- Previous by thread: Re: Conformant IDL array trouble
- Next by thread: Re: Conformant IDL array trouble
- Index(es):
Relevant Pages
|