Thread: DLL and GCC

  1. #1
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008

    DLL and GCC

    I think this is a basic question...
    Could anyone tell me please, how to import DLLs using GCC?

    I'm using Dev C++...

    This one keep failing...

    #define IMPORT __declspec (dllimport)
    template<typename T>class IMPORT TestClass {
      T add(T a, T b);
    int main() {
      TestClass<int> test;
      test.add(10, 20);
      [Linker error] undefined reference to `TestClass<int>::add(int, int)'
    Thanks in advance.
    Just GET it OFF out my mind!!

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    I don't know if I've quite got a hold of what you're asking, but if your DLL has a definition of a template function in it, that's not going to do you any good, since a template definition doesn't compile into anything and g++ doesn't support export yet.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Changing a char pointer via DLL
    By rockpaandi in forum C Programming
    Replies: 5
    Last Post: 04-11-2009, 11:16 PM
  2. Pointer references corrupted via DLL (Cygwin)
    By rockpaandi in forum C Programming
    Replies: 6
    Last Post: 03-16-2009, 06:50 PM
  3. gcc - linking to cwd
    By mike_g in forum Tech Board
    Replies: 3
    Last Post: 08-15-2008, 03:38 PM
  4. Link DLL with Visual C++ not working
    By status() in forum C++ Programming
    Replies: 3
    Last Post: 06-30-2006, 02:47 PM
  5. Using DLL
    By hyvas in forum C Programming
    Replies: 3
    Last Post: 07-05-2004, 11:02 AM