Attributed ATL: [export] problems 
Author Message
 Attributed ATL: [export] problems

Hello,

I am expiarincing this very strange problem and have come to the point where
I can see no reasonable solution (or cause) for the problem, I hope somebody
out here can help me.

I am writing a COM component with Attributed ATL. I want to export some
enums and structs in my generated type library. In one of my header files I
have the following code:

[export]
enum FirstEnum
{
    val1,
    val2

Quote:
};

[export]
enum SecondEnum
{
    blabla,
    something

Quote:
};

[export]
struct TheStruct
{
    int mem1;
    int mem2;

Quote:
};

Everything compiles and links great, Visual C++ generates an IDL file and a
type library.
Strangely, only FirstEnum is actually available in the type library.
SecondEnum and TheStruct make it to the generated IDL file (I checked it and
the syntax and everything looks fine) but not to the type library itself.
I checked the type lib using OLE/COM Object Viewer and Visual Basic's object
browser.

If I remove the [export] attribute from FirstEnum it is SecondEnum that
actually gets exported and so on.

I have found no trace of documentation about this symptom in Microsoft
support and would appreciate any help,
Thanks in advance,
Stav Yagev



Sat, 05 Mar 2005 20:36:08 GMT  
 Attributed ATL: [export] problems

Quote:
>I am writing a COM component with Attributed ATL. I want to export some
>enums and structs in my generated type library. In one of my header files I
>have the following code:
>...
>Everything compiles and links great, Visual C++ generates an IDL file and a
>type library.
>Strangely, only FirstEnum is actually available in the type library.
>SecondEnum and TheStruct make it to the generated IDL file (I checked it and
>the syntax and everything looks fine) but not to the type library itself.

I've exported enums like this:

[export, library_block, v1_enum]
enum EDFileType { edfUnknown, EDF, EDX };

[export, library_block, v1_enum]
enum PassValidType { valid, invalid, multipletokens };

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq



Sat, 05 Mar 2005 21:10:23 GMT  
 Attributed ATL: [export] problems
Try this:
[export, library_block, uuid(287EBF20-60B5-4c86-A7EE-54AE644B2BDF),
v1_enum]
enum FirstEnum
{
    val1,
    val2

Quote:
};

[export, library_block, uuid(934EC2F4-FCB1-49f8-A242-FABD8D8F1A60),
v1_enum]
enum SecondEnum
{
    blabla,
    something

Quote:
};

[export, library_block, uuid(7C68505E-B288-4660-8F7D-33ADF773ADC3)]
struct TheStruct
{
    int mem1;
    int mem2;

Quote:
};

The code you have emits the idl, but not into the library block.
Unless you reference the idl in and interface or coclass, things not
in the library block will not make it into the typelibrary.

-- Rob

Quote:

> Hello,

> I am expiarincing this very strange problem and have come to the point where
> I can see no reasonable solution (or cause) for the problem, I hope somebody
> out here can help me.

> I am writing a COM component with Attributed ATL. I want to export some
> enums and structs in my generated type library. In one of my header files I
> have the following code:

> [export]
> enum FirstEnum
> {
>     val1,
>     val2
> };

> [export]
> enum SecondEnum
> {
>     blabla,
>     something
> };

> [export]
> struct TheStruct
> {
>     int mem1;
>     int mem2;
> };

> Everything compiles and links great, Visual C++ generates an IDL file and a
> type library.
> Strangely, only FirstEnum is actually available in the type library.
> SecondEnum and TheStruct make it to the generated IDL file (I checked it and
> the syntax and everything looks fine) but not to the type library itself.
> I checked the type lib using OLE/COM Object Viewer and Visual Basic's object
> browser.

> If I remove the [export] attribute from FirstEnum it is SecondEnum that
> actually gets exported and so on.

> I have found no trace of documentation about this symptom in Microsoft
> support and would appreciate any help,
> Thanks in advance,
> Stav Yagev



Sun, 06 Mar 2005 05:26:21 GMT  
 Attributed ATL: [export] problems
Try this:
[export, library_block, uuid(287EBF20-60B5-4c86-A7EE-54AE644B2BDF),
v1_enum]
enum FirstEnum
{
    val1,
    val2

Quote:
};

[export, library_block, uuid(934EC2F4-FCB1-49f8-A242-FABD8D8F1A60),
v1_enum]
enum SecondEnum
{
    blabla,
    something

Quote:
};

[export, library_block, uuid(7C68505E-B288-4660-8F7D-33ADF773ADC3)]
struct TheStruct
{
    int mem1;
    int mem2;

Quote:
};

The code you have emits the idl, but not into the library block.
Unless you reference the idl in and interface or coclass, things not
in the library block will not make it into the typelibrary.

-- Rob

Quote:

> Hello,

> I am expiarincing this very strange problem and have come to the point where
> I can see no reasonable solution (or cause) for the problem, I hope somebody
> out here can help me.

> I am writing a COM component with Attributed ATL. I want to export some
> enums and structs in my generated type library. In one of my header files I
> have the following code:

> [export]
> enum FirstEnum
> {
>     val1,
>     val2
> };

> [export]
> enum SecondEnum
> {
>     blabla,
>     something
> };

> [export]
> struct TheStruct
> {
>     int mem1;
>     int mem2;
> };

> Everything compiles and links great, Visual C++ generates an IDL file and a
> type library.
> Strangely, only FirstEnum is actually available in the type library.
> SecondEnum and TheStruct make it to the generated IDL file (I checked it and
> the syntax and everything looks fine) but not to the type library itself.
> I checked the type lib using OLE/COM Object Viewer and Visual Basic's object
> browser.

> If I remove the [export] attribute from FirstEnum it is SecondEnum that
> actually gets exported and so on.

> I have found no trace of documentation about this symptom in Microsoft
> support and would appreciate any help,
> Thanks in advance,
> Stav Yagev



Sun, 06 Mar 2005 05:26:21 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Attributed ATL: [export] problems

2. Attributed ATL: [export] problems

3. ATL, importlib attribute, library attribute, ADO

4. ATL Attribute Problem

5. Problem with generated IDL using ATL attributed project

6. ATL PerfMon attributed code problem

7. A lot of ATL attribute problems

8. problems building attributed ATL project

9. Problems with IErrorInfo in VC.NET attributed ATL project

10. ATL Attribute Problem

11. ATL VC7 attributes and #define

12. Attributed ATL and CoClass naming

 

 
Powered by phpBB® Forum Software