
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
|