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. Regarding COM's Server type(DLL or EXE)

Regarding COM's Server type(DLL or EXE)

Scheduled Pinned Locked Moved COM
comsysadmin
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.
  • K Offline
    K Offline
    Karismatic
    wrote on last edited by
    #1

    I have created a COM based application using DLL server.But i havn't used server as type of EXE.I don't know the exact difference when i will have to use DLL Server or EXE Server with COM base application. Plase reply me as soon as possible. Thanks & Regards Pankaj

    Regards, Pankaj Sachdeva

    M 1 Reply Last reply
    0
    • K Karismatic

      I have created a COM based application using DLL server.But i havn't used server as type of EXE.I don't know the exact difference when i will have to use DLL Server or EXE Server with COM base application. Plase reply me as soon as possible. Thanks & Regards Pankaj

      Regards, Pankaj Sachdeva

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      DLL-based COM objects will load into the calling application's process. If you implement an EXE server, COM will start your EXE as a separate process. This should be transparent to the calling application. The main difference is that it will take much longer to call code running in another process than code running in your own process. To actually call code in another process, or another apartment in the same process, COM must marshal the call parameters across the process or apartment boundary. This means writing out all the parameters, and any other areas of memory they reference, to some transport (e.g. a block of shared memory) and somehow signalling the other process that there is a call for it to handle. When the actual function returns, COM must then marshal the results back to the caller. To do this, it has to know the actual data types and whether a pointer represents a string, an array, or just a single object (and if a string or array, how long the string or array is), and whether the parameters are passed in only, passed out only or passed both in and out. Marshalling can proceed in three ways: 1. The object implements the IMarshal interface; 2. A proxy/stub class is registered for the interface in the registry; 3. A type library is registered to use the Automation marshaller. Option 3 is really a special case of option 2 - the Automation marshaller is registered as the proxy/stub class. It then looks up the correct type library and uses the information in that to perform the marshalling. This is the most limited option, however. You can only use the Automation data types and structures containing those types. The upside is that scripting languages like VBScript can use your components. In general, for option 2, you don't actually write your own code for the proxy/stub class. Instead, you define your interfaces in IDL and pass them through the MIDL tool, which generates either tables describing the interfaces or code. The tables have been supported since Windows 98 and Windows NT 4.0, and an update is available for Windows 95 that supports them. All you have to do is build the code into a DLL; Visual Studio generates a project file for you. COM gets the class factory object for a class implemented in a DLL by calling the DLL's DllGetClassObject function. It cannot call directly into an EXE's code, so the EXE must instead register its class factory objects, for classes that can be created externally, using the CoRegisterClassObject functio

      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