2
Answers

Need help with marshaling in C#...

Tuncay Sanli

Tuncay Sanli

15y
2.6k
1
Hi all... :)

I'll try my best to keep this query as compact as possible...

I'm currently working on a project that involves generating alarms/notifications for the Automated Distributed Control System at the company. Well, for this, the team has created Notification Client and Notification Server Applications.

There is also another .exe created that dumps a message (the message is taken from a database, by means of a function) into a Private queue (which can be viewed in the Computer Management tool). This .exe is intended to run alongside the Notification Server Application, which accesses the queue to obtain the messages, which are then  displayed at the User Station by means of a method created (called rhsc_notifications; I'll detail that later).

The problem we are facing is that the display at the User station is truncated, i.e. in all fields, only the first character is displayed, and remaining data is missing. (The alarm/notification is displayed as multiple fields like Alarm generation location, priority, description, time, etc.).

This problem is faced when the Notification Server uses a method called rhsc_notifications directly. However, one of the team members created an interface in Visual Basic. This interface is called by the Notification Server, and the interface processes the message, and calls the rhsc_notifications method to display the message at the User Station. When this interface is used, the display turns out fine, no truncation. However, when the rhsc_notifications method is called directly from the Notification Server Application, there is truncation.

We are required to eliminate this interface, and call rhsc_notifications method directly. The thing is that this method uses a library that has NOT been developed in a .Net environment. Hence, there is the need to marshal the data.

We've tried a few things with marshaling, but the problem hasn't been resolved. So I'm hoping you guys will be able to help me out with this...

So, can I go ahead and post the code?

Thanks in advance... :)

Tunçay

Answers (2)