CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Apr 2009
    Posts
    5

    COM server written in C#

    Below is the partial code for COM server written in C#. I have copied an interface.

    COM server interface in C#:

    [Guid("4df99b70-e148-4432-b004-4c9eeb535a5e")]
    public interface IFunctionDiscovery
    {
    unsafe void GetInstanceCollection(string pszCategory, string pszSubCategory, int fIncludeAllSubCategories, CFunctionInstanceCollection** ppCFunctionInstanceCollection);

    };
    public class SampleClass : IFunctionDiscovery
    {
    public unsafe void GetInstanceCollection(string pszCategory, string pszSubCategory, int fIncludeAllSubCategories, CFunctionInstanceCollection** ppCFunctionInstanceCollection)
    {
    System.Console.WriteLine("GetInstanceCollection() called...");
    CFunctionInstanceCollection* ppFIC = new CFunctionInstanceCollection();
    ppCFunctionInstanceCollection = &ppFIC;
    }
    }


    Compiling the C# code, gives an error:

    Program.cs(19,21): error CS0208: Cannot take the address of, get the size of, or
    declare a pointer to a managed type

    Compiler is pointing at the last argument in GetInstanceCollection method of COM server. Does anyone know how to fix the problem?

    Thanks!
    Last edited by n4nature; November 23rd, 2010 at 04:03 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured