Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. Passing complex type through COM interface ?

Passing complex type through COM interface ?

Scheduled Pinned Locked Moved COM
comsysadminhelptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alwin75
    wrote on last edited by
    #1

    Hi all, Can anybody give me some pointers on how to pass the following complex type through a COM interface ?

    typedef struct ComplexType
    {
    Type type; // can be INT, BSTR, BYTE* etc.
    union
    {
    int intVal;
    BSTR strVal;
    BYTE* pbyteVal;
    AnotherComplexType* pcomplexVal;
    };
    };

    The real type contains different fields but you should get the idea: it basically is just like a VARIANT only with more levels of indirection. I need to pass these structures between my COM component and non-COM legacy code. Unfortunately, there is a threading issue that causes a proxy and stub to be created even for in-process deployment of my component, so simply passing a pointer doesn't work. Should I resort to custom marshalling ? Kind regards, Alwin!

    J 1 Reply Last reply
    0
    • A Alwin75

      Hi all, Can anybody give me some pointers on how to pass the following complex type through a COM interface ?

      typedef struct ComplexType
      {
      Type type; // can be INT, BSTR, BYTE* etc.
      union
      {
      int intVal;
      BSTR strVal;
      BYTE* pbyteVal;
      AnotherComplexType* pcomplexVal;
      };
      };

      The real type contains different fields but you should get the idea: it basically is just like a VARIANT only with more levels of indirection. I need to pass these structures between my COM component and non-COM legacy code. Unfortunately, there is a threading issue that causes a proxy and stub to be created even for in-process deployment of my component, so simply passing a pointer doesn't work. Should I resort to custom marshalling ? Kind regards, Alwin!

      J Offline
      J Offline
      Jorgen Sigvardsson
      wrote on last edited by
      #2

      Define your type(s) in IDL and it will create marshalling code for it. -- He just smiled and gave me a vegemite sandwich.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups