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

Strange Problem With Interop

Hi there,

i have a web service which is using a dll written in vc7.This dll in
turn is accessing a vc6 com dll through interop.

Now the problem is that i have a function in vc6 that takes as param
zipped data and returns me unzip data.The params it takes r
1)the starting memory address of the zipped data
2)the length of the zipped data
3)an empty string in which the unzip data is returned(out param)
4)length of unzipped data

Now when i call this method from my web service through the vc7 dll,
sometimes it returns me the correct unzipped data and sometimes it does
not.

My question is why is the same code giving me different results?

BTW, the unzipping of the data is done using a very well tested API so
there shud be no problem with the unzipping of data.

I think it has something to do with managed/unmanaged memory,not really
sure...
So, plz help me out on this...

Bye.

Jan 24 '06 #1
1 1127
One possible reason might be is that the GC does memory optimization
when running, so it moves memory locations around for a more compact
heap. If you are passing in some pointer/ref variables to the VC lib,
which then passes those to the vb6 program, it might happen that the GC
at times might move memory around while the vb6 program is running,
thus the garbled message...

One possible solution could be to use the fixed statement to pin the
memory location of your managed variables and then call the VC lib to
do the unzipping...

unsafe void UnzipSomething (string something)
{
string unzipped = string.Empty;
char[] values = something.ToCharArray ();
int length = values.Length;
fixed (char* test = &values[0])
{
//
}
}

Jan 24 '06 #2

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

Similar topics

0
by: jb_in_marietta | last post by:
I have a Dot Net project that references a COM DLL called "Crypto.dll," which is registered on my machine. I added the reference via the "Add Reference" dialog in Visual Studio Dot Net, and I am...
2
by: Vincent | last post by:
Hi, I had beta 1 of VS2005. I uninstalled it before installing VS 2005 Pro Beta 2 Now whenever I create a new project, the form1 gives this error: Method not found: 'Int32...
0
by: Lars von Wedel | last post by:
Hello, I am developing a module using C# which serves as a plugin with a COM interface for a couple of weeks now. Everything works fine until this morning: without knowing what I changed...
13
by: Tamir Khason | last post by:
I have an Application While running it on computer (just runtime) WITH VS works fine, BUT running it on other computer without VS it just do not want to run (exit with code 0 ) What can be...
0
by: Gerhard Menzl | last post by:
I got no response to this in microsoft.public.dotnet.framework.interop, and since it is a C++-related problem, I am now trying it here: I am using an Interop assembly for communication between my...
5
by: GD1 | last post by:
Dear developers, I've been working on a Word automator application for some weeks. Now, I formatted my hard drive and reinstalled Visual Studio. When I compiled my project for the first time...
0
by: Nicholas Dreyer | last post by:
Operating System: Microsoft Windows Version 5.1 (Build 2600.xpsp_sp2_gdr.050301-1519 : Service Pack 2) Visual Basic: MIcrosoft Visual Basic 6.3 Version 9972 VBA: Retail 6.4.9972 Forms3:...
2
by: Nicholas Dreyer | last post by:
The following error Run-time exception thrown : System.Runtime.InteropServices.COMException - Error loading type library/DLL. happens while running the code listed at the bottom of this...
0
by: tekiegreg | last post by:
Hi there, here is a snippet of my code that I've been getting an error message on, basically what I've been trying to do is pull out appointments, serialize to an object as well as all the contacts...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.