Thread: Dll problem

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    14

    Question Dll problem

    Hi folks,

    after being recommended on using VS 2005 here from you folks I did so, and everything fine so far but now there is a problem, I was following a tutorial, and the writer was using VS 2003.

    The thing is that he created dll then he used dll functions in another c++ project everything fine on his computer (his studio created lib file) besides dll there is supposed to be created a lib file, but my VS 2005 (pro.) is not creating one and so I can't really import functions in another project.

    Basically I'm interested to create functions in C++ and use them in C#, can anyone help accomplish this? (I don't really need this for real world program its just for learning purposes)

    Thanx in advance
    Fiska

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    The compiler will not generate the .lib file if the dll contains no exported functions or objects. Put this in one of the *.cpp files and you will get a .lib file. Then do the same thing with the other functions/objects you want to be visible outside the dll.
    Code:
    __declspec( dllexport ) int foo;

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    14
    I did that
    Code:
    extern "C" __declspec( dllexport ) int foo;
    and on the actuall project I tried to import it this way:
    Code:
    extern "C" __declspec( dllimport) int foo;
    but I get errors and I see no .lib file!

    Can someone tell me as well on how to use these functions in a C# project ?

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    I'm not going to answer the same question on two different boards.

    http://www.daniweb.com/techtalkforums/thread42693.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DLL Function / Load Library Problem
    By cboard_member in forum Windows Programming
    Replies: 5
    Last Post: 12-10-2005, 10:11 AM
  2. Replies: 1
    Last Post: 09-18-2005, 09:06 PM
  3. .lib vs .h vs .dll
    By Shadow12345 in forum C++ Programming
    Replies: 13
    Last Post: 01-01-2003, 05:29 AM
  4. std::string vs char* DLL problem
    By aker_y3k in forum C++ Programming
    Replies: 13
    Last Post: 10-02-2002, 09:05 AM
  5. VCL and DLL class problem
    By borland_man in forum C++ Programming
    Replies: 1
    Last Post: 02-13-2002, 11:07 AM