473,794 Members | 2,880 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?

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 1936
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*******@disc ussions.microso ft.com> wrote in message
news:58******** *************** ***********@mic rosoft.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
4393
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
3892
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
6147
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
3315
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
0
1546
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) program which can load and call exported functions from the old style dlls. With little documentation to go on, my legacy app defines
20
5060
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
1833
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
6914
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
3
10562
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 using out there and why. Thanks!
4
8438
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
9672
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
10435
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
10213
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...
0
10000
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
9037
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...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.