How to export function in a VB DLL 
Author Message
 How to export function in a VB DLL

Can anybody tell me how to make functions in a DLL accessible ?

I created a DLL with a few VB functions. It does build correctly and the
calling program loads the DLL but cannot find the functions. Checking the
DLL I found that it does not export any functions.
I searched the documentation for instructions but couldn't find a hint or a
sample.

Thanks for any help.

Kurt



Tue, 21 Sep 2004 01:07:12 GMT  
 How to export function in a VB DLL

Quote:
> Can anybody tell me how to make functions in a DLL accessible ?

> I created a DLL with a few VB functions. It does build correctly and the
> calling program loads the DLL but cannot find the functions. Checking the
> DLL I found that it does not export any functions.
> I searched the documentation for instructions but couldn't find a hint or
a
> sample.

Kurt,

Do you mean "Exported" like a "C" DLL? If so, .NET cannot do this.

If you mean just exposed so that other applications can call them through
either a Class instance of Public Module then you need to make sure that
both the Class/Module and the Functions/Sub are declared "Public"

Hope this helps?

Cal



Tue, 21 Sep 2004 01:43:48 GMT  
 How to export function in a VB DLL

.NET actually can do this, however it produces
unverifyable code, therefore isn't permitted by the VB.NET
or C# compilers.  Managed C++ can do it, and it is
performed without any need for x86 code.  If you wanted
to, you could compile your program with VB.NET, ildasm it,
add the necessary IL, and then ilasm it.

The following shows how .NET exports a function:

The following is put in the assembly:

.data D_00004000 = bytearray (01 00 00 06)
.vtfixup [1] int32 fromunmanaged at D_00004000 // 06000001

The following is put in the method you want to export:

.vtentry 1 : 1
.export [1] as Multiply

I have attached the full IL of a .NET library that exports
a function for educational purposes.  It can be compiled
using the following syntax:

ilasm TestExport.il /DLL

This assembly offers the function as both an exported
function and as a normal static .NET method.

Quote:
>-----Original Message-----
>> Can anybody tell me how to make functions in a DLL
accessible ?

>> I created a DLL with a few VB functions. It does build
correctly and the
>> calling program loads the DLL but cannot find the

functions. Checking the
Quote:
>> DLL I found that it does not export any functions.
>> I searched the documentation for instructions but

couldn't find a hint or
Quote:
>a
>> sample.

>Kurt,

>Do you mean "Exported" like a "C" DLL? If so, .NET cannot
do this.

>If you mean just exposed so that other applications can
call them through
>either a Class instance of Public Module then you need to
make sure that
>both the Class/Module and the Functions/Sub are
declared "Public"

>Hope this helps?

>Cal

>.

  TestExport.il
< 1K Download


Tue, 21 Sep 2004 22:10:01 GMT  
 How to export function in a VB DLL

Quote:
> This assembly offers the function as both an exported
> function and as a normal static .NET method.

Thanks Justin. I learn something new everyday!!!!

Cal



Wed, 22 Sep 2004 01:00:14 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. export a function when creating a DLL in VB

2. Declaring VB DLL Function for Export

3. export a function when creating a DLL in VB

4. How to: export function from VB DLL?

5. Problem of VB calling DLL function exported with __declspec(dllexport) in VC++

6. How to: export function from VB DLL?

7. DLL C Function Export for VB

8. Exporting Visual Basic functions & DLL's

9. Exporting Visual Basic functions & DLL's

10. Exporting functions from DLLs

11. Exporting dll functions

12. Passing a String to an exported dll function

 

 
Powered by phpBB® Forum Software