How to create a dll?

Please help!

Does anyone know I can create a DLL using VB5 so that I can call the DLL in another VB5 program using the format:

Private Function MyFunction Lib "MyLib" (ByVal String1 As String, ByVal String2 As String) As String
X=MyFunction("String1", "String2")
dont_have_a_clueAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mcriderConnect With a Mentor Commented:
You may want to try PowerBASIC DLL Compiler for Windows
http://www.powerbasic.com/products/pbdll32/ 
 
Cheers!
0
 
mcriderCommented:
Sorry, but I don't think that's possible in VB5...

Cheers!
0
 
BSmileyCommented:
You can do that in VB6, but I don't think VB5 would produce a compiled binary DLL or EXE.

On the other hand, you could set it up as an automation server and access it from another VB5 program using OLE Automation.  This has performance penalties if you are calling it often, but it might suite your needs.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
corvanderlindenCommented:
It can be done (with any version of VB).

You must use the Declare statement (otherwise you get a compile error)

Private Declare Function MyFunction Lib "MyLib" (ByVal String1 As String, ByVal String2 As String) As String

Declare: Used atmodule level to declare references to externalprocedures in a dynamic-link library (DLL).

This DLL should be e.g. C(++) Fortran or masm

You could use a third party tool (like desaware) to export your DLL functions so they can be called from extern.


0
 
lpsharmaCommented:
You can create the DLL(ActiveX DLL) in VB5 using ActiveX DLL Project. You will have to create the required classes in the DLL project. But, this DLL cannot be called in the specific format that you want. That type of calling can only be done with server DLLs (which you create in VC++, etc). The ActiveX DLL has to be registered on your machine and referenced in your VB5 standard project.
0
 
dont_have_a_clueAuthor Commented:
Lpsharma, Sorry, but I don't want to use activex.  I want to be able to call the DLL just like I said.

McRider, I am investigating PowerBasic...

CorvanderLinden, I know how to declare the DLL... I want to know how to create A DLL using VB5.

I'm not very good at C, and I only have TurboC for DOS.
0
 
corvanderlindenCommented:
I tried to make clear that it is NOT possible to use VB the way you want to.
(see VB help for the Declare Statement)

If you want to make a DLL in VB you will have to use lpsharma's solution, there is NO other way in VB.

If you then want to use this DLL by your method (Declare statement) you have to use third party tools to export your ActiveX DLL methods


0
 
v_iyengarCommented:
bsmiley i too want to know it
i work in vb6 how to do that
please give me step by step information
0
 
gwambCommented:
In VB u can't create classic DLL. In VB u can create only ActiveX DLL!
0
 
dont_have_a_clueAuthor Commented:
McRider, I order powerbasic.  Thanks for your help.
0
 
mcriderCommented:
Thanks for the points! Glad I could help!


Cheers!
0
All Courses

From novice to tech pro — start learning today.