Results 1 to 5 of 5

Thread: Exporting classes from a DLL

  1. #1
    Zaei
    Guest

    Exporting classes from a DLL

    This is probably something stupid, but I dont know.

    I am trying to export a class from a DLL. Inside of the class is a custom templated queue class. When I compile, I get a warning saying:
    Code:
    c:\divinity\classes\cobject.h(94) : warning C4251: 'MsgQueue' : class 'Queue<struct DMSG>' needs to have dll-interface to be used by clients of class 'CObject'
    I have tried adding __declspec(dllexport) to my Queue class, etc. Also, the application using it works just fine. I just want to get rid of the warning. Any ideas?

    Z.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You can't export a template, but you can export a specialisation of it

    Basically...did you set your project options to use the runtime library as a DLL rather than a static library?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Zaei
    Guest
    I just left it as whatever the default is. Should I just convert my template to a regular class? It isnt used for anything else...

    Z.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    If you think about it logically, it's pointless exporting a template since it's only a template as far as the compiler is concerned - it's used for conditional code generation.

    I made that mistake before
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Zaei
    Guest
    Alrighty, conversion time =).

    Thanks much!

    Z.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width