Visual C++

Moderators: Lundin
Number of threads: 379
Number of posts: 695

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to create class DLL Posted by RajeshKapure on 29 Jul 2005 at 6:30 AM
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



Report
Re: How to create class DLL Posted by MT2002 on 29 Aug 2005 at 3:42 PM
: 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

First create a DLL project with the two classes in.
This is what I do:
class foo
{
   Create ();
};

// DLLs follow the C calling convention, so there
//is no standard way to export classes directly. MSVC
// provides a nonstandard way though.
extern "C"
{
_declspec (dllexport) int InitDLLInterface (foo** obj)
{
  *obj=new foo;
  return 0;
}
_declspec (dllexport) void ShutdownDLLInterface (foo** obj)
{
  delete obj;
}
}

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!

Report
Re: How to create class DLL Posted by rlr4me on 24 Apr 2011 at 9:48 AM
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

Report
Re: How to create class DLL Posted by vatsa_mitr on 22 Mar 2012 at 5:40 AM
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
www.objectiveprogramming.com
Report
Re: How to create class DLL Posted by vatsa_mitr on 22 Mar 2012 at 5:43 AM
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
www.objectiveprogramming.com



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.