Thread: Create .dll with Studio.NET in C++

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    4

    Create .dll with Studio.NET in C++

    I am trying to export some functions that I can import from other c++ or c# code. I know this can be done without creating a .dll project. I use the __declspec(dllexport) command on the function prototype and
    for the project properties I have configuration type set to dll.
    This code builds but there is no .dll file being generated. Any ideas why? Thanks for any help.

    ------------------------------------
    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    __declspec( dllexport ) int AddNums(int a, int b); // prototype
    
    
    int AddNums (int a, int b)
    {
      return a+b;
    }

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Make sure under General in your project properties Configuration Type is Dynamic Library. Also check to see that the output (Linker->General) has .dll for its extension (eg, "$(OutDir)\$(ProjectName).dll")
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    4
    Great, thats it. Thanks a lot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can't create child windows
    By OnionKnight in forum Windows Programming
    Replies: 4
    Last Post: 04-10-2011, 04:13 PM
  2. Create a file from c++ program
    By Dan17 in forum C++ Programming
    Replies: 2
    Last Post: 05-08-2006, 04:25 PM
  3. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  4. How to create a file association program?
    By eShain in forum Windows Programming
    Replies: 1
    Last Post: 03-06-2006, 12:15 PM
  5. How to Create reference to an array in C++
    By shiv_tech_quest in forum C++ Programming
    Replies: 2
    Last Post: 12-20-2002, 10:01 AM