473,397 Members | 2,084 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,397 software developers and data experts.

declare of unmanaged dll with marshalling (as any)

I'm stuck. There's a 3rd party dll(not COM) called rscw32.dll that
communicates with a Tandem computer(I know HP bot em but it still a
Tandem to me). I'm trying to create my own .net dll that utilizes the
rscw32.dll so others can communicate with the Tandem. The users of my
dll will want to send varying message formats. The problem comes in
with the
'declare' . The 3rd party dll prototype looks like:
USHORT RscWriteRead(ULONG ulOpt1 in
ULONG ulOpt2 in
ULONG ulOpt3 in
char *pcServername in
SHORT siHandle1 in
VOID *pvMsgGoingToTandem
in
USHORT uWriteSize
in
VOID *pvMsgComingFromTandem
out
USHORT *puMsgSizeFromTandem);
in/out

A vb6 declare that works great looks like:
Declare Function RscWriteRead% Lib "C:\RSC\rscw32.DLL" Alias "RSCWR"
(ByVal ulOptions&, ByVal ulConnect&, ByVal ulSession&, ByVal
pcServerName$, ByVal nIo%, pvRequestBuffer As Any, ByVal uRequestSize%,
pvReplyBuffer As Any, puReplySize As Any)

I've got the vb.net piece working by declaring the function like:
Declare Function RscWriteRead Lib "C:\RSC\rscw32.DLL" Alias "RSCWR"
(ByVal ulOptions As UInt32, ByVal ulConnect As UInt32, ByVal ulSession
As UInt32, <MarshalAs(UnmanagedType.LPStr)> ByVal pcServerName As
String, ByVal nIo As Short, <MarshalAs(UnmanagedType.LPStr)> ByVal
sRequest As String, ByVal uRequestSize As UInt16, ByRef srvReply As
ServerMsg_def, <MarshalAs(UnmanagedType.U2)> ByRef puReplySize As
UInt16) As UInt16

As long as ServerMsg_def matches what the user is needing to send to
the Tandem, all is well, but there can be literally thousands of
different message formats needing sent.
The problem with the way I've got it working is that all users can send
messages to the Tandem but only if their message matches the format of
ServerMsg_def. Any help would be greatly appreciated.

May 23 '06 #1
0 1578

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

Similar topics

0
by: Bruce Farmer | last post by:
I am having problems accessing a managed object from unmanaged code. Specifically, I have a .NET forms application with a web service proxy. The forms application links to an unmanaged DLL which...
1
by: Lucia | last post by:
I'm working at .NET project to implement a COM interface for a .NET control. The .NET assembly is built with the correct license for the control. Some unmanaged code is creating an instance of...
1
by: jayderk | last post by:
I can not seem to find the thread that described how to expose the functions of functions that are usable in an unmanaged dll? any help would be great regards, Jay
3
by: FarmerJohn | last post by:
Hello I am using a C# file to run some code that will extract a single html filename from a list of html file names (stored in file or list). I would then like to be able to display the html file...
0
by: Smugsboy | last post by:
Hi, I have a managed Application (C#) that uses a managed DLL (MC++) which uses an unmanaged DLL (C++). All reside under the same solution. The unmanaged DLL has virtual methods, it is loaded...
3
by: Marty | last post by:
Hi, Can I mix my managed code within my unmanaged code? Just for instance, I have a socket class that is managed code. It is include in my unmanaged VC++ project and it compile. The point...
6
by: Bob Altman | last post by:
Hi all, I have an unmanaged console app written in C++. I can't figure out how to get C++ to do the standard issue "press any key to continue" thing: cout << "Press any key to continue: ";...
0
by: mehdi_mousavi | last post by:
Hi, Consider an unmanaged ATL class, that has to keep the track of two managed member variables of two different types: Image and Color. I've got no problem using the Image member variable, where...
6
by: Bruce | last post by:
I need to fire an event from an unmanaged class. If I declare a pointer to the managed class within the unmanaged class I get a compile error " "cannot declare a managed 'm_pGps' in an unmanaged...
1
by: Bruce | last post by:
I am getting the following exception in the release build of my assembly. {"Attempted to read or write protected memory. This is often an indication that other memory is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
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,...
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
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...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.