Export VB Functions

Is it possible to export a VB function from a VB DLL to a VB EXE much like the way a C function can be exported to a VB EXE?  Oh, Yes!  Without using COM Objects.  And could you send an example?
cogleyAsked:
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.

manojaminCommented:
I don't think so!! As far as I know, there is now way as of now!!
0
MirkwoodCommented:
It is a general misunderstanding that VB dll can export function.
Public functions in a dll are not exported.
VB cannot export functions like C that can. I repeat CANNOT do that.
The only DLL's that VB can make are ActiveX dll's.

What you can do is put your functions that your want to export in a class which is "globalmultiuse" Now application that use this DLL can make a reference to this DLL like any ActiveX dll. They can now use the functions.

BTW: Using a class to reference your functions has the advantage that the location of the DLL is not important anymore. If your are referencing exported functions, that you need the location of the DLL or the DLL should be in your path.

1) Create two projects:
       a) Tstclient (Standard Exe)
       b) TstServer (ActiveX dll)

2) Add a class TstClass to TstServer

3) Change property of class to "GlobalMultiUse"

4) Add functions to TstClass
          TstMyFunction1
          TstMyFunction2

5) Add TstServer as reference to TstClient

6) Now you can use TstMyFunction1 and TstMyFunction anywhere in TstClient.
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
morchubooCommented:
If you want to create standard DLLs that allow exported functions, see this site for a VB addin:

http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=53476&lngWId=1

It is possible due to VB using the same linker as Visual C++, so a quick aleration of the linking options allows normal DLLs

Hope it helps
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.