Mimick the older C/ pascal dll parameter passing convention? - VB Class Mod?

G

Guest

Hello,

I have been attempting to write a VB class that would
expose its stuff to an older (ok, legacy application)
program which can load and call exported functions from
the old style dlls.

With little documentation to go on, my legacy app defines
a dll to load, then can call an exported function from the
dll with up to 12 tokens on the call line. Appears to
call by value. I have my only example working real good in
an older test C DLL application, I get all the random
integers I want.

I know the functions within the DLL are to be defined in C
as follow:

int FAR PASCAL RandomInt( HWND app, HANDLE appInst,
void far * far *vdatptr, LPBYTE vtypeptr, int argcnt )

The 5 arguments are defined:

1. [HWND] - a handle to the App main window.

2. [HANDLE] - a handle to the app instance that made the
DLL call.

3. [void far * far *] - a far array of far pointers to
the data elements listed as parameters on the app line
that called the DLL function.

4. [LPBYTE] - a far array of bytes. Byte N of this array
describes the type of element N stored in the array of
data elements (e.g., parameter 3).
The range of values in this array follows this scheme:

Byte Value Meaning
========== =======
0 nth element is a string

1 nth element is an integer

2 nth element is a long

3 nth element is a float

5. [int] - an integer containing the count of parameters
provided on the app line calling the DLL function.


This syntax is pretty old. Is there a way in VB.net to
allow this old app to load and call from a VB dll? A VB
class module gens a DLL that this app can load. I am lost
in the paramaters. Is this something to do with
marshalling?

Any advice welcome.

Thank you.

Richard Buckshaw
 
K

Klaus H. Probst

You can't do this from managed code. Being able to export methods directly
from an assembly would defeat the whole point of managed code =)

About the only thing you can do is create a wrapper with MC++, and then call
your VB assembly from it when the other application calls the entry point.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top