473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 22 '05 #1
1 1907
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.
--
____________________
Klaus H. Probst, MVP
http://www.vbbox.com/

"R BUckshaw" <an*******@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.com...
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 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris Gordon-Smith | last post by:
I am tying to call a Pascal function from C++, and vice versa. Does anyone know how to do this, or where detailed information on this topic can be found? For the C++ to Pascal call I have...
90
by: Jhon smith | last post by:
Hi all,Just wondering are there any problems with learning c from older books,as I have picked up some from 1988,1994,1997,1998. By using books of this age(Im on a tight budget)am I going to...
14
by: Pollux | last post by:
I'm having a problem with something I thought was quite simple. I have a function in a C DLL. Let's call it SomeFunction. This is the prototype for SomeFunction: void SomeFunction(char *...
21
by: vmsgman | last post by:
Here is a code sample ... int blah = ReadFile( defArray, defFileName, w, h); // Read File Contents into memory array and return for processing public int ReadFile( ref ushort nArray, string...
0
by: Richard Buckshaw | last post by:
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)...
20
by: Brien King | last post by:
If I have a parameter that has an Object type (as opposed to something like a string), can I make that parameter a CONST? Right now, if you pass an object into a sub/function, that sub/function...
1
by: matthew breedlove | last post by:
I have a Managed VC++ WinForms app in VC8 calling a member function of a class in a native DLL. My managed code is similar to this: System::Void btnTest_Click(System::Object^ sender,...
6
by: kkrish | last post by:
hi, I am working on an old program written in c.The program uses a function like this "unsigned long int far pascal ReadFile(char *buff,unsigned long int *size)" . Is this a PASCAL...
3
by: Grey Squirrel | last post by:
On wednesday my company will have an open ended discussion whether to standardize hungarian notation or pascal/cammel case notation. We'd love to recieve some feedback on what other people are...
4
by: Virtual_X | last post by:
some function make the data type of it's parameters as "const char*" why not use char or char* instead what would be different
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.