Create .dll with Studio.NET in C++

This is a discussion on Create .dll with Studio.NET in C++ within the C++ Programming forums, part of the General Programming Boards category; I am trying to export some functions that I can import from other c++ or c# code. I know this ...

  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, 05:23 AM
  4. How to create a file association program?
    By eShain in forum Windows Programming
    Replies: 1
    Last Post: 03-06-2006, 11:15 AM
  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, 09:01 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21