Newbie Question: How to Mark Class as CLS Compliant 
Author Message
 Newbie Question: How to Mark Class as CLS Compliant

Hi,

We've written a managed C++ class wrapper over several unmanaged C++
classes.

In testing (via a VB.NET application) I've noticed that certain methods have
ended up as not CLS compliant. I see that in C# there is a way to mark the
assembly... but I'm not exactly sure how to do it in C++ (and for each class
individually).

Any suggestions are welcome. Code examples would be great.

Thanks,

-Chris



Wed, 23 Feb 2005 03:02:47 GMT  
 Newbie Question: How to Mark Class as CLS Compliant
Hello Chris,

It is unfortunately that the current version compiler of Visual C++ .NET
doesn't support the CLSCompliantAttribute. Though you can apply this
attribute in your code and the compiler emits the right data to the
metadata, the compiler will not generate an error or a warning when the
assembly is exposing a class that is a type that is non-Common Language
Specification (CLS) compliant. This could cause a problem when the assembly
is used by another compiler that enforces CLS compliance rules.

You may refer to the article below to get more detailed information about
this issue:

INFO: Visual C++ .NET Compiler Does Not Generate Non-CLS Compliance Warning
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q309813&

I hope this information is helpful for you.

Best regards,

Lion Shi, MCSE, MCSD
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.  2001 Microsoft Corporation. All rights
reserved.
--------------------

    Subject: Newbie Question: How to Mark Class as CLS Compliant
    Date: Fri, 6 Sep 2002 12:02:47 -0700
    Lines: 17
    X-Priority: 3
    X-MSMail-Priority: Normal
    X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

    Newsgroups: microsoft.public.dotnet.languages.vc
    NNTP-Posting-Host: 24.77.216.242
    Path: cpmsftngxa10!cpmsftngxa06!tkmsftngp01!tkmsftngp11
    Xref: cpmsftngxa10 microsoft.public.dotnet.languages.vc:14153
    X-Tomcat-NG: microsoft.public.dotnet.languages.vc

    Hi,

    We've written a managed C++ class wrapper over several unmanaged C++
    classes.

    In testing (via a VB.NET application) I've noticed that certain methods
have
    ended up as not CLS compliant. I see that in C# there is a way to mark
the
    assembly... but I'm not exactly sure how to do it in C++ (and for each
class
    individually).

    Any suggestions are welcome. Code examples would be great.

    Thanks,

    -Chris



Sat, 26 Feb 2005 18:06:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Are const method parameters CLS compliant?

2. Are unsigned types not CLS compliant?

3. Passing a byte array that is CLS compliant

4. CLS-compliant compiler errors

5. CLS-Compliant Method Cannot Return an enum?

6. TextWriter.Write Method not CLS-compliant

7. Two newbie questions: CLS Compliance + FAQs

8. question mark operator questions (forwarded)

9. What MFC classes read from Twain-compliant scanners?

10. What MFC classes read from Twain-compliant scanners?

11. How do I mark managed classes as Unicode?

12. CLS in C???--probably a stupid question...

 

 
Powered by phpBB® Forum Software