However, when I build the client I get the following errors:
error C2146: syntax error : missing ';' before identifier 'GetType' error C2501: 'CommsServer::_UserDatagramProtocol::_TypePtr' : missing storage-class or type specifiers warning C4183: 'GetType': missing return type; assumed to be a member function returning 'int' error C2143: syntax error : missing ';' before 'CommsServer::_UserDatagramProtocol::GetType' error C2433: '_TypePtr' : 'inline' not permitted on data declarations error C2501: '_TypePtr' : missing storage-class or type specifiers error C2064: term does not evaluate to a function taking 2 arguments
I tried creating the object in VB6 as well, but that doesn't work either.
********************************************************************** Please note: This e-mail and its attachments contain only the opinions of the sender and do not necessarily reflect the policy(s) of the communisis group in general.
Employees of the communisis group are required not to make any defamatory statements and not to infringe or authorise any infringement of copyright or any other legal right by e-mail. Any such communication is therefore outside the scope of employment of the individual concerned. The communisis group will not accept any liability in respect of such a communication.
Confidentiality: This e-mail and any attachments, together with their contents, are confidential unless otherwise explicitly stated in writing by the sender of this e-mail and are for the intended recipient only. If they have come to you in error you must not take any action in respect of them, which includes but is not limited to reproducing, sending or storing them, other than to notifying the sender immediately of the mistake, and deleting the e-mail, any attachments and any reproductions made by replying to it.
Viruses: This e-mail and any attachments have been scanned for viruses but we cannot guarantee that they are virus free. The recipient should check this e-mail and any attachments for viruses. The communisis group accepts no responsibility for any damage caused by any virus transmitted by this e-mail or any of its attachments. In the event of any unauthorised copying or forwarding, the recipient will be required to indemnify the communisis group against any claim for loss or damage caused by any viruses or otherwise. **********************************************************************
______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
As you are (rightly) suppressing the class interface, you need to supply an explicit interface for COM to use. Thus, something like:
[assembly:ComVisible(true)]
[Guid(...)] public interface ICommsServer { ... }
[ClassInterface(ClassInterfaceType.None)] public class CommsServer : ICommsServer { ... }
I'm not sure if this is actually the cause of your problem, but it's something I think you'll need to be aware of.
If adding the explicit interface doesn't help, it might be worth having a look in the generated TLH and TLI files and see if anything you'd expect to see (e.g. GUIDs, class/interface names, etc.) is obviously missing.
Hope this helps,
-- Ivan Towlson White Carbon
-----Original Message----- From: Discussion relating to the specifics of the C# and Managed C++ languages [mailtoOTNET-CX@DISCUSS.DEVELOP.COM]On Behalf Of Paul Grenyer Sent: 12 May 2004 13:46 To: DOTNET-CX@DISCUSS.DEVELOP.COM Subject: [DOTNET-CX] Creating COM components in C#
I want to create a C# dll that is available to COM aware clients. I've followed the example in Inside C# (2nd Ed) and have the following:
It gives me the error message "Class Not Registered". My tlh looks like this:
// Created by Microsoft (R) C/C++ Compiler Version 13.10.3077 (2fb42baa). // // c:\temp\c#\commsserver\client\debug\commsserver.tlh // // C++ source equivalent of Win32 type library ..\bin\debug\CommsServer.tlb // compiler-generated file created 05/12/04 at 15:46:41 - DO NOT EDIT!
-----Original Message-----> From: Ivan Towlson [mailto:ivan.towlson@WHITE-CARBON.COM]> Sent: 12 May 2004 15:22> To: DOTNET-CX@DISCUSS.DEVELOP.COM> Subject: Re: [DOTNET-CX] Creating COM components in C#>
As you are (rightly) suppressing the class interface, you> need to supply> an explicit interface for COM to use. Thus, something like:>
[assembly:ComVisible(true)]>
[Guid(...)]> public interface ICommsServer { ... }>
[ClassInterface(ClassInterfaceType.None)]> public class CommsServer : ICommsServer { ... }>
I'm not sure if this is actually the cause of your problem, but it's> something I think you'll need to be aware of.>
If adding the explicit interface doesn't help, it might be> worth having> a look in the generated TLH and TLI files and see if anything you'd> expect to see (e.g. GUIDs, class/interface names, etc.) is obviously> missing.>
Hope this helps,>
--> Ivan Towlson> White Carbon>
-----Original Message-----> From: Discussion relating to the specifics of the C# and Managed C++> languages [mailtoOTNET-CX@DISCUSS.DEVELOP.COM]On Behalf Of Paul> Grenyer> Sent: 12 May 2004 13:46> To: DOTNET-CX@DISCUSS.DEVELOP.COM> Subject: [DOTNET-CX] Creating COM components in C#>
I want to create a C# dll that is available to COM aware clients. I've> followed the example in Inside C# (2nd Ed) and have the following:>
______________________________________________________________________> This email has been scanned by the MessageLabs Email Security System.> For more information please visit http://www.messagelabs.com/email> ______________________________________________________________________>
********************************************************************** Please note: This e-mail and its attachments contain only the opinions of the sender and do not necessarily reflect the policy(s) of the communisis group in general.
Employees of the communisis group are required not to make any defamatory statements and not to infringe or authorise any infringement of copyright or any other legal right by e-mail. Any such communication is therefore outside the scope of employment of the individual concerned. The communisis group will not accept any liability in respect of such a communication.
Confidentiality: This e-mail and any attachments, together with their contents, are confidential unless otherwise explicitly stated in writing by the sender of this e-mail and are for the intended recipient only. If they have come to you in error you must not take any action in respect of them, which includes but is not limited to reproducing, sending or storing them, other than to notifying the sender immediately of the mistake, and deleting the e-mail, any attachments and any reproductions made by replying to it.
Viruses: This e-mail and any attachments have been scanned for viruses but we cannot guarantee that they are virus free. The recipient should check this e-mail and any attachments for viruses. The communisis group accepts no responsibility for any damage caused by any virus transmitted by this e-mail or any of its attachments. In the event of any unauthorised copying or forwarding, the recipient will be required to indemnify the communisis group against any claim for loss or damage caused by any viruses or otherwise. **********************************************************************
______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
Have a look in the registry to see if the CLSID mentioned in the TLH is>registered. If not, you may need to make the class ComVisible and>re-regasm.>
Another possible issue is whether COM can actually find your assembly.>Your .NET assembly needs to be either in your app (EXE) directory or the>GAC. (Even though your class is registered as a COM component, it's>*not* globally accessible a la COM unless you put it in the GAC. The>registered COM handler for all .NET classes is mscoree.dll, not the .NET>assembly itself.)>
-->Ivan Towlson>White Carbon>
-----Original Message----->From: Discussion relating to the specifics of the C# and Managed C++>languages [mailtoOTNET-CX@DISCUSS.DEVELOP.COM]On Behalf Of Paul>Grenyer>Sent: 12 May 2004 14:44>To: DOTNET-CX@DISCUSS.DEVELOP.COM>Subject: Re: [DOTNET-CX] Creating COM components in C#>
namespace CommsServer>{> [ClassInterface(ClassInterfaceType.None)]> public class UserDatagramProtocol : IUserDatagramProtocol> {> }>}>
It gives me the error message "Class Not Registered". My tlh looks like>this:>
dont know if it will help, but when i was using some COM stuff, I had to use regsvcs.exe to register my dlls.
Have a look in the registry to see if the CLSID mentioned in the TLH is registered. If not, you may need to make the class ComVisible and re-regasm.
Another possible issue is whether COM can actually find your assembly. Your .NET assembly needs to be either in your app (EXE) directory or the GAC. (Even though your class is registered as a COM component, it's *not* globally accessible a la COM unless you put it in the GAC. The registered COM handler for all .NET classes is mscoree.dll, not the .NET assembly itself.)
-- Ivan Towlson White Carbon
-----Original Message----- From: Discussion relating to the specifics of the C# and Managed C++ languages [mailtoOTNET-CX@DISCUSS.DEVELOP.COM]On Behalf Of Paul Grenyer Sent: 12 May 2004 14:44 To: DOTNET-CX@DISCUSS.DEVELOP.COM Subject: Re: [DOTNET-CX] Creating COM components in C#
namespace CommsServer { [ClassInterface(ClassInterfaceType.None)] public class UserDatagramProtocol : IUserDatagramProtocol { } }
It gives me the error message "Class Not Registered". My tlh looks like this:
Make sure that you use the /codebase option when you use regasm. Your COM components will not be able to see it otherwise.
Example:
regasm /codebase MyComInterop.dll
Cheers, Rocco Martin Corillian
-----Original Message----- From: Discussion relating to the specifics of the C# and Managed C++ languages [mailtoOTNET-CX@DISCUSS.DEVELOP.COM] On Behalf Of Sean Chapman Sent: Wednesday, May 12, 2004 7:59 AM To: DOTNET-CX@DISCUSS.DEVELOP.COM Subject: Re: [DOTNET-CX] Creating COM components in C#
Ivan Towlson wrote:
Have a look in the registry to see if the CLSID mentioned in the TLH is>registered. If not, you may need to make the class ComVisible and>re-regasm.>
Another possible issue is whether COM can actually find your assembly.>Your .NET assembly needs to be either in your app (EXE) directory or
GAC. (Even though your class is registered as a COM component, it's>*not* globally accessible a la COM unless you put it in the GAC. The>registered COM handler for all .NET classes is mscoree.dll, not the
.NET>assembly itself.)>
-->Ivan Towlson>White Carbon>
-----Original Message----->From: Discussion relating to the specifics of the C# and Managed C++>languages [mailtoOTNET-CX@DISCUSS.DEVELOP.COM]On Behalf Of Paul>Grenyer>Sent: 12 May 2004 14:44>To: DOTNET-CX@DISCUSS.DEVELOP.COM>Subject: Re: [DOTNET-CX] Creating COM components in C#>
namespace CommsServer>{> [ClassInterface(ClassInterfaceType.None)]> public class UserDatagramProtocol : IUserDatagramProtocol> {> }>}>
It gives me the error message "Class Not Registered". My tlh looks like>this:>
dont know if it will help, but when i was using some COM stuff, I had to use regsvcs.exe to register my dlls.
[ComVisible(true)] [Guid("144B64C7-DA04-45ba-A61F-C8954627ADAA")] [ClassInterface(ClassInterfaceType.None)] public class UserDatagramProtocol : IUserDatagramProtocol {
....
Rebuilt the DLL and then rebuilt the type library. Still "Class not registered".
Another possible issue is whether COM can actually find your assembly.> Your .NET assembly needs to be either in your app (EXE)> directory or the> GAC. (Even though your class is registered as a COM component, it's> *not* globally accessible a la COM unless you put it in the GAC. The> registered COM handler for all .NET classes is mscoree.dll,> not the .NET> assembly itself.)
That was it! I needed to put the C# dll in the same directory as my client executable. Thanks!
I now need to investigate the GAC as this component I am writing is for use with SQL server.
********************************************************************** Please note: This e-mail and its attachments contain only the opinions of the sender and do not necessarily reflect the policy(s) of the communisis group in general.
Employees of the communisis group are required not to make any defamatory statements and not to infringe or authorise any infringement of copyright or any other legal right by e-mail. Any such communication is therefore outside the scope of employment of the individual concerned. The communisis group will not accept any liability in respect of such a communication.
Confidentiality: This e-mail and any attachments, together with their contents, are confidential unless otherwise explicitly stated in writing by the sender of this e-mail and are for the intended recipient only. If they have come to you in error you must not take any action in respect of them, which includes but is not limited to reproducing, sending or storing them, other than to notifying the sender immediately of the mistake, and deleting the e-mail, any attachments and any reproductions made by replying to it.
Viruses: This e-mail and any attachments have been scanned for viruses but we cannot guarantee that they are virus free. The recipient should check this e-mail and any attachments for viruses. The communisis group accepts no responsibility for any damage caused by any virus transmitted by this e-mail or any of its attachments. In the event of any unauthorised copying or forwarding, the recipient will be required to indemnify the communisis group against any claim for loss or damage caused by any viruses or otherwise. **********************************************************************
______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
********************************************************************** Please note: This e-mail and its attachments contain only the opinions of the sender and do not necessarily reflect the policy(s) of the communisis group in general.
Employees of the communisis group are required not to make any defamatory statements and not to infringe or authorise any infringement of copyright or any other legal right by e-mail. Any such communication is therefore outside the scope of employment of the individual concerned. The communisis group will not accept any liability in respect of such a communication.
Confidentiality: This e-mail and any attachments, together with their contents, are confidential unless otherwise explicitly stated in writing by the sender of this e-mail and are for the intended recipient only. If they have come to you in error you must not take any action in respect of them, which includes but is not limited to reproducing, sending or storing them, other than to notifying the sender immediately of the mistake, and deleting the e-mail, any attachments and any reproductions made by replying to it.
Viruses: This e-mail and any attachments have been scanned for viruses but we cannot guarantee that they are virus free. The recipient should check this e-mail and any attachments for viruses. The communisis group accepts no responsibility for any damage caused by any virus transmitted by this e-mail or any of its attachments. In the event of any unauthorised copying or forwarding, the recipient will be required to indemnify the communisis group against any claim for loss or damage caused by any viruses or otherwise. **********************************************************************
______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
Check the assemblyinfo.cs file, tight at the bottom, it's always there
-----Original Message----- From: Paul Grenyer [mailtoaul.Grenyer@COMMUNISIS-DM.CO.UK] Sent: 13 May 2004 09:30 AM To: DOTNET-CX@DISCUSS.DEVELOP.COM Subject: Re: [DOTNET-CX] Creating COM components in C#
*** Before acting on this e-mail or opening any attachment you are advised to read the disclaimer at the end of this e-mail ***
All
It appears I have fallen at the next hurdle...
I have tried to register my c# dll in the Global Assembly Cash with gacutil.exe. which gives me the following error message:
Failure adding assembly to the cache: Attempt to install an assembly without a strong name
A quick investigation of MSDN and C# Programming by Jesse Liberty suggest that I can give my c# dll a strong name using the sn tool:
********************************************************************** Please note: This e-mail and its attachments contain only the opinions of the sender and do not necessarily reflect the policy(s) of the communisis group in general.
Employees of the communisis group are required not to make any defamatory statements and not to infringe or authorise any infringement of copyright or any other legal right by e-mail. Any such communication is therefore outside the scope of employment of the individual concerned. The communisis group will not accept any liability in respect of such a communication.
Confidentiality: This e-mail and any attachments, together with their contents, are confidential unless otherwise explicitly stated in writing by the sender of this e-mail and are for the intended recipient only. If they have come to you in error you must not take any action in respect of them, which includes but is not limited to reproducing, sending or storing them, other than to notifying the sender immediately of the mistake, and deleting the e-mail, any attachments and any reproductions made by replying to it.
Viruses: This e-mail and any attachments have been scanned for viruses but we cannot guarantee that they are virus free. The recipient should check this e-mail and any attachments for viruses. The communisis group accepts no responsibility for any damage caused by any virus transmitted by this e-mail or any of its attachments. In the event of any unauthorised copying or forwarding, the recipient will be required to indemnify the communisis group against any claim for loss or damage caused by any viruses or otherwise. **********************************************************************
______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
************************************************************************************************************************** Everything in this e-mail and attachments relating to the official business of MultiChoice Africa is proprietary to the company. Any view or opinion expressed in this message may be the view of the individual and should not automatically be ascribed to the company. If you are not the intended recipient, you may not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify the sender immediately by email, facsimile or telephone and destroy the original message. **************************************************************************************************************************
********************************************************************** Please note: This e-mail and its attachments contain only the opinions of the sender and do not necessarily reflect the policy(s) of the communisis group in general.
Employees of the communisis group are required not to make any defamatory statements and not to infringe or authorise any infringement of copyright or any other legal right by e-mail. Any such communication is therefore outside the scope of employment of the individual concerned. The communisis group will not accept any liability in respect of such a communication.
Confidentiality: This e-mail and any attachments, together with their contents, are confidential unless otherwise explicitly stated in writing by the sender of this e-mail and are for the intended recipient only. If they have come to you in error you must not take any action in respect of them, which includes but is not limited to reproducing, sending or storing them, other than to notifying the sender immediately of the mistake, and deleting the e-mail, any attachments and any reproductions made by replying to it.
Viruses: This e-mail and any attachments have been scanned for viruses but we cannot guarantee that they are virus free. The recipient should check this e-mail and any attachments for viruses. The communisis group accepts no responsibility for any damage caused by any virus transmitted by this e-mail or any of its attachments. In the event of any unauthorised copying or forwarding, the recipient will be required to indemnify the communisis group against any claim for loss or damage caused by any viruses or otherwise. **********************************************************************
______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
-----Original Message-----> From: Discussion relating to the specifics of the C# and > Managed C++ languages [mailtoOTNET-CX@DISCUSS.DEVELOP.COM] > On Behalf Of Paul Grenyer> Sent: Donnerstag, 13. Mai 2004 09:30> To: DOTNET-CX@DISCUSS.DEVELOP.COM> Subject: Re: [DOTNET-CX] Creating COM components in C#>
*** Before acting on this e-mail or opening any attachment > you are advised to read the disclaimer at the end of this e-mail ***>
It appears I have fallen at the next hurdle...>
I have tried to register my c# dll in the Global Assembly > Cash with gacutil.exe. which gives me the following error message:>
Failure adding assembly to the cache: Attempt to install an > assembly without a strong name>
A quick investigation of MSDN and C# Programming by Jesse > Liberty suggest that I can give my c# dll a strong name using > the sn tool:>
**********************************************************************> Please note: This e-mail and its attachments contain only the > opinions of the sender and do not necessarily reflect the > policy(s) of the communisis group in general.>
Employees of the communisis group are required not to make > any defamatory statements and not to infringe or authorise > any infringement of copyright or any other legal right by > e-mail. Any such communication is therefore outside the scope > of employment of the individual concerned. The communisis > group will not accept any liability in respect of such a > communication.>
Confidentiality: This e-mail and any attachments, together > with their contents, are confidential unless otherwise > explicitly stated in writing by the sender of this e-mail and > are for the intended recipient only. If they have come to you > in error you must not take any action in respect of them, > which includes but is not limited to reproducing, sending or > storing them, other than to notifying the sender immediately > of the mistake, and deleting the e-mail, any attachments and > any reproductions made by replying to it.>
Viruses: This e-mail and any attachments have been scanned > for viruses but we cannot guarantee that they are virus free. > The recipient should check this e-mail and any attachments > for viruses. The communisis group accepts no responsibility > for any damage caused by any virus transmitted by this e-mail > or any of its attachments. In the event of any unauthorised > copying or forwarding, the recipient will be required to > indemnify the communisis group against any claim for loss or > damage caused by any viruses or otherwise.> **********************************************************************>
______________________________________________________________________> This email has been scanned by the MessageLabs Email Security System.> For more information please visit > http://www.messagelabs.com/email > ______________________________________________________________________>
That was it! I needed to put the C# dll in the same directory> as my client> executable. Thanks!>
I now need to investigate the GAC as this component I am> writing is for use> with SQL server.
While the GAC is probably a better location for the assembly, realize that you can use the /codebase option in regasm.exe to specify the location of your assembly (thus eliminating the need for the GAC).
*** Before acting on this e-mail or opening any attachment you are advised to read the disclaimer at the end of this e-mail ***
Hi
While the GAC is probably a better location for the assembly,> realize that> you can use the /codebase option in regasm.exe to specify the> location of> your assembly (thus eliminating the need for the GAC).
That sounds like a better solution. I'll try it, thanks!
********************************************************************** Please note: This e-mail and its attachments contain only the opinions of the sender and do not necessarily reflect the policy(s) of the communisis group in general.
Employees of the communisis group are required not to make any defamatory statements and not to infringe or authorise any infringement of copyright or any other legal right by e-mail. Any such communication is therefore outside the scope of employment of the individual concerned. The communisis group will not accept any liability in respect of such a communication.
Confidentiality: This e-mail and any attachments, together with their contents, are confidential unless otherwise explicitly stated in writing by the sender of this e-mail and are for the intended recipient only. If they have come to you in error you must not take any action in respect of them, which includes but is not limited to reproducing, sending or storing them, other than to notifying the sender immediately of the mistake, and deleting the e-mail, any attachments and any reproductions made by replying to it.
Viruses: This e-mail and any attachments have been scanned for viruses but we cannot guarantee that they are virus free. The recipient should check this e-mail and any attachments for viruses. The communisis group accepts no responsibility for any damage caused by any virus transmitted by this e-mail or any of its attachments. In the event of any unauthorised copying or forwarding, the recipient will be required to indemnify the communisis group against any claim for loss or damage caused by any viruses or otherwise. **********************************************************************
______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
If you would like to report an abuse of our service, such as a spam message, please . Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .