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. DCOM server

DCOM server

Scheduled Pinned Locked Moved COM
c++comsysadminhelptutorial
2 Posts 2 Posters 3 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.
  • R Offline
    R Offline
    Roger
    wrote on last edited by
    #1

    I am trying to write a DCOM server application. Some of the interface functions have paramaters that are user defined data types (structs). I have the header files where these type definitions are included in the server .h file included in the .h file of the server .cpp file. When I try to build, I receive the following error that points back to the .idl file: "Expecting type specification near "data_type". Any advice on how to remedy this. I am fairly new to DCOM/COM programming.

    L 1 Reply Last reply
    0
    • R Roger

      I am trying to write a DCOM server application. Some of the interface functions have paramaters that are user defined data types (structs). I have the header files where these type definitions are included in the server .h file included in the .h file of the server .cpp file. When I try to build, I receive the following error that points back to the .idl file: "Expecting type specification near "data_type". Any advice on how to remedy this. I am fairly new to DCOM/COM programming.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Hi, (1) Your interfaces which uses structs or other defined types must me custom defined. (2) The only place where you must define your structs is the .idl file (see below). (3) Don't forget to compile your PS.mk (Visual Studio generatied make file) (4) Use CoTaskMemAlloc() and CoTaskMemFree() to transfer the struct data (example shows an array of structs) Success Aat EXAMPLE // YourServer.idl : IDL source for YourServer.dll // // This file will be processed by the MIDL tool to // produce the type library (YourServer.tlb) and marshalling code. import "oaidl.idl"; import "ocidl.idl"; typedef struct { int iType; int iValue; // E.t.c. } YOURSTRUCT; // .... [ object, uuid(BECF60B9-2741-11D4-A05E-00B0D0201DD6), helpstring("IYourObject Interface"), pointer_default(unique) ] interface IYourObject : IUnknown { [helpstring("method Read")] HRESULT Read([out,size_is(,*plNumStructs)] YOURSTRUCT** ppYourStructs, [in, out] long* plNumStructs); [helpstring("method Write")] HRESULT Write([in,size_is(lNumStructs)] YOURSTRUCT* pYourStructs, [in] long lNumStructs); };

      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