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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
Sorry, but I don't think that's possible in VB5...

Cheers!
0
mcriderCommented:
You may want to try PowerBASIC DLL Compiler for Windows
http://www.powerbasic.com/products/pbdll32/ 
 
Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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 Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.