By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,301 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,301 IT Pros & Developers. It's quick & easy.

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

P: n/a
Mimick the older C/ pascal dll parameter passing convention? - VB Class Mod?

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
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.