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. void* in a parameter in COM function

void* in a parameter in COM function

Scheduled Pinned Locked Moved COM
questioncomhelp
3 Posts 2 Posters 8 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.
  • J Offline
    J Offline
    Jafet Sanchez 0
    wrote on last edited by
    #1

    Hello!! how can i use void pointers in a parameter in a funcion of COM class?? I try this: ..........MyFuncion([out,retval] void * pResult) and when i compile it CRASHHHHHHHH!!!!!!!!! please help me... my email is jsanchez@cie.com.mx

    A 2 Replies Last reply
    0
    • J Jafet Sanchez 0

      Hello!! how can i use void pointers in a parameter in a funcion of COM class?? I try this: ..........MyFuncion([out,retval] void * pResult) and when i compile it CRASHHHHHHHH!!!!!!!!! please help me... my email is jsanchez@cie.com.mx

      A Offline
      A Offline
      Alex Gorev
      wrote on last edited by
      #2

      Hi, The problem with any kind of pointers is that you can't return or pass it without marshaling the data it points to. If you are using the pointer to the well-known types, such as Long, BSTR, ... the default marshaling can be used. If you use an array of objects or void pointer you must provide additional information for marshalling. Have a look at the length_is() and other array related attributes of the IDL file. You also can return an array of data using a variant with SAFEARRAY. This is the best thing you can do if you are going to use the component in VB. Regards, Alex Gorev, Dundas Software.

      1 Reply Last reply
      0
      • J Jafet Sanchez 0

        Hello!! how can i use void pointers in a parameter in a funcion of COM class?? I try this: ..........MyFuncion([out,retval] void * pResult) and when i compile it CRASHHHHHHHH!!!!!!!!! please help me... my email is jsanchez@cie.com.mx

        A Offline
        A Offline
        Alex Gorev
        wrote on last edited by
        #3

        Hi Jafet, There are several techniques you can use and returning the VOID pointer is not one of them. There is a VERY nice article by Don Box in MSDN explaining your options and advantages/disadvantages. The name of the article is "OLE Q&A". There are several articles with this name and I add the beginning of the article, so it will be easier to find. Regards, Alex Gorev, Dundas Software. ------------------------------------------------------ " OLE Q&A Don Box Don Box has been working in networking and distributed object systems since 1989. He is currently chronicling the COM lifestyle in book form for Addison Wesley, and gives seminars on OLE and COM across the globe. Don can be reached at dbox@braintrust.com. QI am using dual interfaces to expose my objects to both C++ and Visual BasicТ clients. Designing the interfaces was relatively painless once I passed simple data types as method parameters. I now need to pass user-defined structures as parameters and can't get it to work. Any suggestions? .... " -- MSDN. ------------------------------------------------------ ----- Original Message ----- From: Jafet Sanchez Rodriguez To: Sent: Tuesday, July 04, 2000 11:42 AM Subject: Re: [CodeProject] Re: void* in a parameter in COM function > Hi Alex!! > I want to pass a struct from vc to vb .. > > struct A > { > int a; > int b; > float c; > } > > MYSTRUCT A; >

        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