Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to create class DLL

RajeshKapureRajeshKapure Posts: 9Member
Hello ,

I am developing application using COM interface. in that
application i created 2 class.
Now i want to convert that application in dll.
But i don't know how to create Class DLL in vc++ and use that
DLL in VB.

plase tell me how to create class DLL and how to use in vb.
send me source code if possile or tell me the steps.

waiting for +ve response.

Regards,
Rajesh



Comments

  • MT2002MT2002 Posts: 1,444Member
    : Hello ,
    :
    : I am developing application using COM interface. in that
    : application i created 2 class.
    : Now i want to convert that application in dll.
    : But i don't know how to create Class DLL in vc++ and use that
    : DLL in VB.
    :
    : plase tell me how to create class DLL and how to use in vb.
    : send me source code if possile or tell me the steps.
    :
    : waiting for +ve response.
    :
    : Regards,
    : Rajesh
    [blue]
    First create a DLL project with the two classes in.
    This is what I do:[/blue][code]
    class foo
    {
    Create ();
    };
    [blue]
    // DLLs follow the C calling convention, so there
    //is no standard way to export classes directly. MSVC
    // provides a nonstandard way though.[/blue]
    extern "C"
    {
    _declspec (dllexport) int InitDLLInterface (foo** obj)
    {
    *obj=new foo;
    return 0;
    }
    _declspec (dllexport) void ShutdownDLLInterface (foo** obj)
    {
    delete obj;
    }
    }[/code][blue]
    If you link in the DLL's *.lib file, the OS will
    automatically load the DLL at startup. Or you could
    load it via MSVC ::LoadLibrary().

    Sorry, dont know how to link DLLs with VB though.

    Good Luck![/blue]
  • rlr4merlr4me Posts: 1Member
    The dll was great. But i want to know how the above code implement in in a class.

    waiting for a postive response

    Regards
    Rejeesh R

  • vatsa_mitrvatsa_mitr Posts: 5Member
    As you said,how to implement this code in a class.If I got your problem right, you need to create an MFC extension dll.
    After creation and successful registration of this dll you can add reference in VB project.please go through the link below (if not found):

    http://www.codeguru.com/cpp/cpp/cpp_mfc/tutorials/article.php/c4017

    When you raised this question by saying you have an application using COM interface,why don't you create COM dll?

    regards,
    Vatsa
    [link=http://www.objectiveprogramming.com]www.objectiveprogramming.com[/link]
  • vatsa_mitrvatsa_mitr Posts: 5Member
    As you said,how to implement this code in a class.If I got your problem right, you need to create an MFC extension dll.
    After creation and successful registration of this dll you can add reference in VB project.please go through the link below (if not found):

    http://www.codeguru.com/cpp/cpp/cpp_mfc/tutorials/article.php/c4017

    When you raised this question by saying you have an application using COM interface,why don't you create COM dll?

    regards,
    Vatsa
    [link=http://www.objectiveprogramming.com]www.objectiveprogramming.com[/link]
Sign In or Register to comment.