473,624 Members | 2,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
0 1541

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

Similar topics

1
396
by: R BUckshaw | last post by:
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
4
4383
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 tried declaring the Pascal function as:- extern "C" void PASCALTESTFUNC1(); within my C++ code. However, the linker is giving me an unresolved
90
3821
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 missout on anything in the langauge or has C remaind similar. I intend to use Dev-C++ on the windows platform. If any one feels theres anything I should be aware of,please help me out,I feel a bit lost with all thats out there regarding this language....
14
6137
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 * anArrayOfChars); where anArrayOfChars is an out parameter. I thought all I had to do was declare it as follows:
21
3288
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 sFname, int w, int h) { FileStream fs = new FileStream(sFname, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); // Read data
20
5039
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 can modify the object no matter how it's defined (ByVal or ByRef). In some cases, I want to make sure that you cannot modify the object. Is there a way to do that in VS2003 or the up comming VS2005?
1
1827
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, System::EventArgs^ e) { Receiver r; std::vector<char> v; v.push_back('A');
6
6899
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 function CALL from C?Do I need to have Pascal installed in my system.This has been written in Turbo C 2.0 under
4
8384
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
8242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8681
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8629
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
2611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.