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. Multiple import

Multiple import

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

    Hi all, I have a question on multiple import. The following describe my scenerio: I have first created a dll, which contains a COM object with the following idl: interface A : public IUnknown { HRESULT MethodA(); }; Later, I have created a second dll, which contains a COM object that make use of the first dll. Therefore, in the second dll's idl file, I did the following: import A.dll interface B : public IUnknown { HRESULT MethodB( [in] A* foo ); }; The problem comes when I wrote a client to test out both servers. Since my client needs to create A to pass it to the method in B, I need to include both dlls in my client file: #import A.dll; #import B.dll; void main() { // first create A // then create B // next, pass A into B } The problem arises when I tried to compile the client program. I got a redefinition of A. Does anybody know what I should do? Thanks, Sunny

    J 1 Reply Last reply
    0
    • S Sunny_leung

      Hi all, I have a question on multiple import. The following describe my scenerio: I have first created a dll, which contains a COM object with the following idl: interface A : public IUnknown { HRESULT MethodA(); }; Later, I have created a second dll, which contains a COM object that make use of the first dll. Therefore, in the second dll's idl file, I did the following: import A.dll interface B : public IUnknown { HRESULT MethodB( [in] A* foo ); }; The problem comes when I wrote a client to test out both servers. Since my client needs to create A to pass it to the method in B, I need to include both dlls in my client file: #import A.dll; #import B.dll; void main() { // first create A // then create B // next, pass A into B } The problem arises when I tried to compile the client program. I got a redefinition of A. Does anybody know what I should do? Thanks, Sunny

      J Offline
      J Offline
      Joao Vaz
      wrote on last edited by
      #2

      Sunny, Have you tried only to import b.dll ? When you are importing B , you're importing A implicitly , so I think that you only need the #import B.dll. Cheers, Joao Vaz

      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