473,378 Members | 1,369 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,378 software developers and data experts.

C# and VC++ 6.0 DLL..

I$B!G(Bm working on a C# .NET application that is showing some strange behavior
when calling a DLL using PInvoke or COM Interop. The DLL was written in VC6
and is used to control an external device via serial communications. I am
calling a method in the DLL that returns measurement data from the device.

According to the specifications of the device, the DLL should return
measurement data after 1.5 seconds. In fact, if I create a standalone VC6
application, a call to the DLL method does return data after 1.5 seconds.
But, if I make the same call to the DLL from C#, it takes 4 seconds to
return data. This is a time critical application and 4 seconds is not
acceptable. There is nothing different in the configuration except that I$B!G(Bm
calling the DLL from C# instead of VC6. I$B!G(Bve experimented with PInvoke and
COM Interop and both have similar behavior. Unfortunately, I don$B!G(Bt have
access to the source code of the DLL so I cannot debug what is happening
inside it.

My theory is that there is something about how the .NET runtime sets up the
apartment for the DLL execution that is different from VC6. The DLL is
probably trying to perform some memory operations or serial port operations
that the .NET runtime is restricting. This results in some errors that slow
down execution of the DLL. This makes me wonder if there is some way to
change parameters of PInvoke or COM Interop so that the DLL is not
restricted. So far, I cannot find any information on this issue.

Any information or suggestions would be greatly appreciated. Thank you for
your help.
Nov 16 '05 #1
3 3088
Hi Harish,

I guess the delay was due to the interoperability!

One thing you could do is have your VC++ DLL onto the
COM+/Component Services and see if there is any
improvement in the time.

Also, the usage of RCW shall not be a problem calling
unmanaged COM components in .NET

HTH
irfan
Nov 16 '05 #2
Thanks Irfan but unfortunately this did not work.

"Irfan" <sy********@ge.com> wrote in message
news:3d****************************@phx.gbl...
Hi Harish,

I guess the delay was due to the interoperability!

One thing you could do is have your VC++ DLL onto the
COM+/Component Services and see if there is any
improvement in the time.

Also, the usage of RCW shall not be a problem calling
unmanaged COM components in .NET

HTH
irfan

Nov 16 '05 #3
Hi Harish,

http://www.vsj.co.uk/dotnet/display.asp?id=174 article
might be of much use for you.

Irfan
Nov 16 '05 #4

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

Similar topics

11
by: Tatu Portin | last post by:
Have this kind of struct: typedef struct { char **user_comments; /* ... */ } vorbis_comment; /* prototype */ char * read_vorbis_string ( FILE *sc);
4
by: Anthony Gallagher | last post by:
I have a bunch of libraries compiled using VC++ 6.0, and I am trying to recompile one of our projects using VC++ .NET. I get all kind of linker errors (specially in STL calls). How do I get rid of...
5
by: Hari | last post by:
Guys please help me to solve this strange problem what Iam getting as follows.. Trying to instantiate a global instance of a template class as follows :- when i build this code with debug and...
2
by: vemulakiran | last post by:
Hi all, I have doubt regarding .NET. I have a tool which was developed on VC++ 6.0(Win32 Application ). The application communicates with library (API) which was developed on VC++ 6.0 called core...
2
by: | last post by:
Everything seems to be moving to .NET and VC++ seems to be adding a lot of managed code support every new release. The questions: is unmanaged code in VC++ beeing phased out in favour of managed...
4
by: ultranet | last post by:
I have cruised around http://msdn.microsoft.com/visualc/ and the rest of the site, and i am not able to find a single C++ or VC++ certification exam that will be available after June 30, 2004. I...
1
by: Steve | last post by:
We are considering the ways to migrate our VC++ 6.0 applications to .NET platform. It would be nice to rewrite them completely in C#, but due to the time constraints this option is out of...
2
by: um | last post by:
When the POSIX pthreads library for w32 release 2-2-0 (http://sources.redhat.com/pthreads-win32/) is compiled with VC++6 then it compiles and passes all the benchmark tests in the subdirectory...
15
by: Michael Tissington | last post by:
I have a Visual Basic 6.0 ActiveX Control. It seems there is no way with VS 2005 to create a similar control for containers that host ActiverX controls, is this correct ? I'm thinking of...
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...

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.