IDL - structures as parameters

I added to my IDL file the following structure: (it's a com custom interface ATL object)
typedef struct _MyStructure {
    char a;
    char b;
} MyStructure;
this structure is used as one of the [in] parameters of one of the method's in my object's interface.
When I "rebuild all" my dll, the idl file seems OK', but I get strange errors:
error c2259: 'CComObject<class CMyClass> : cannot instantiate abstract class due to the following members:....
while compiling class-template member function 'long __stdcall ATL::CComCreator<class ATL::CComObject<class MyClass>>::CreateInstance(void *,const struct _GUID &, void **)'
Again: When I just create an ATL project and adds an ATL object - it works fine.
But when I add this structure-based parameters - I get the compilation errors.
Am I using the structure incorrectly ?
How should I use it ?
I'd like a code sample please.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

   I created an ATL project and added to the IDL your struct (nothing else) and I got a laundry list of errors.
   I know this isn't a solution nor answer, but in this case why can't you just have 2 [in] parameters, one for the first character and another for the second character?  Atleast with known types, you don't have to worry about proxy/stub stuff (just put oleautomation in your IDL).
livniAuthor Commented:
My structure has 10 parameters.
I gave here 2 parameters just for the sample...
This error is generated when the CPP file containing the implimentation fo the COM object does not contain the function you defined in the IDL file.

Due to the following members...

Tells you which members are the one you are not implimenting.

Double check all your parameters in the header file and the CPP file and then it should work.

I tried this with an ATL project and it worked fine.

Hope this helps.

Gunnar Valur
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

livniAuthor Commented:
I doubled check them.
All are implemented.
There's probably a problem with the way I'm passing the structure as parameter.
I'm gonna try pass a pointer to the struct instead of the struct by value and see how it goes.
I am almost sure that this error is due to mismatch between IDL and the CPP implimentation because I have fought this error way to often. 8-)

This error also often occures if you for example have moved the IDL generated header file and an old copy lies somewhere.

If you send me the error message, the IDL file, the object header and cpp file I would be happy to check this out for you.  My e-mail is

Gunnar Valur
livniAuthor Commented:
Problem solved.
The error is occured because when I use char type in the idl file, it is translated to unsigned char on the cpp file, and leaves the h file with char.

if I change the h to unsigned char too,
then the function won't appear under the Interface on the class list.

Solution - using CHAR type will do the job.
As I said.  Type mismatch 8-)

Gunnar Valur
livniAuthor Commented:
The fact that this is a type mismatch is understandable from the compiler error lines.
I couldn't understand WHAT is the mismatch. that's why i double-checked everything.
If you still think you deserve the points - post an answer. I won't argue.
Thanks Livni

I is totally up to you if I get points.  Only give them to me if I deserve them.

Happy coding.

Gunnar Valur


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.