need help with exporting DLL with a class in it

This is a discussion on need help with exporting DLL with a class in it within the Windows Programming forums, part of the Platform Specific Boards category; //this is my DLL code Code: #include "stdafx.h" #include <stdio.h> extern "C" __declspec(dllexport)void test(); BOOL APIENTRY DllMain( HANDLE hModule, DWORD ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    315

    need help with exporting DLL with a class in it

    //this is my DLL code
    Code:
    #include "stdafx.h"
    #include <stdio.h>
    
    extern "C" __declspec(dllexport)void test();
    
    BOOL APIENTRY DllMain( HANDLE hModule, 
                           DWORD  ul_reason_for_call, 
                           LPVOID lpReserved
    					 )
    {
        return TRUE;
    }
    
    class __declspec(dllexport) MyClass
    {
    int myInt;
    };
    
    extern "C" __declspec (dllexport) MyClass;
    //this compiles fine , i copy dll.dll and dll.lib to the cpp where main is ...
    //this is the main cpp file

    Code:
    #include <iostream.h>
    #pragma comment(lib , "dll.lib")
    
    extern "C" __declspec (dllexport) MyClass;
    
    
    
    
    int main()
    {
    
       MyClass My; //but i am unable todo this ???????????
    
        return 0;
    }

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    you do not expect to export class as a C feature?

    PS.
    #include <iostream.h> - it is outdated
    use <iostream>
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    315
    can anone help?,

  4. #4
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    Maybe an example will help you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calling a class member through a pointer to a class in a DLL
    By cboard_member in forum C++ Programming
    Replies: 1
    Last Post: 04-19-2006, 10:55 AM
  2. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  3. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 02:20 AM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 06:18 AM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 01:30 PM

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