Hi all,
I encounter a problem with a library method that should create a multi
dimensional string array.
Below is the method:
--------------------------------------------------------------------------------
public class StringArrayLibr ary
{
public void Create(ref string[,] names)
{
names = new string[3,3];
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
names[i, j] = "John Smith";
}
}
}
}
--------------------------------------------------------------------------------
Calling this method from another c# program is not a problem and works
as expected.
This method has to be available for COM applications also, so i
changed the project property
[assembly: ComVisible(true )]
and I registered the assembly via:
regasm /codebase arraylibrary.dl l
Aff course I want to test the com interface by creating a VB6
application and adding the following piece of code in the form_load
----------------------------------------------------------------------
Private Sub Form_Load()
Dim lib As Object
Dim names() As String
Set lib = CreateObject("A rrayLibrary.Str ingArrayLibrary ")
lib.Create names
End Sub
----------------------------------------------------------------------
This program crashes big time and even closes VB6 development
environment.
Next I did was creating the VB6 .EXE and set the "Start external
program" of the .Net arraylibrary project the the vb6 project.exe to
debug the method from VS2005. This crashes with the following
exception:
------------------------------------------------------------
FatalExecutionE ngineError was detected:
The runtime has encountered a fatal error. The address of the error
was at 0x7a03d1be, on thread 0xc9c. The error code is 0xc0000005. This
error may be a bug in the CLR or in the unsafe or non-verifiable
portions of user code. Common sources of this bug include user
marshaling errors for COM-interop or PInvoke, which may corrupt the
stack.
------------------------------------------------------------
n.b. 1.
When the C# method is changed to return the string[,] it works fine,
but in my situation is has to be a (reference) parameter.
n.b. 2.
Changing from late binding to early binding does not change the
behaviour.
Any ideas what to do to solve this problem?
Thanks in advance,
Rik Moed 0 1343 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: KGriffin |
last post by:
Hello,
I want to store values from several text boxes into a "list" and
associate a string with each value. should i use a multi dimensional
array, and how do i use it?
Thanks,
k
*** Sent via Developersdex http://www.developersdex.com ***
|
by: Tad Marshall |
last post by:
Hi,
I'm reading about arrays in VB.NET and I seem to have a few options for my
data structure. I need a multi-dimensional array of structures, and my
first thought was
Public Structure myStr
Public part1 as Integer
Public part2 as Integer
End Structure
|
by: entitledX |
last post by:
Hi, I'm trying to use the HDF library to read a few HDF files that I
need to process. The data in each file varies in rows, but the
columns remain constant. Because of that, I had dynamically allocated
a set of
pointer to pointers as my multi-dimensional arrays. Here is my code (i
have omitted checking calloc's return value to make this shorter):
int **filter;
filter = calloc( ylength, sizeof(int*) );
for( i = 0 ; i < ylength...
|
by: Balaskas Evaggelos |
last post by:
Hi,
does anyone know how i can sort a multi-dimensional array
by a specific field ?
for example i want to sort arr where n=2,
but i need the data of every array to follow that order.
example array:
arr
|
by: vvenk |
last post by:
Hello:
Is is possible to declare a 2-dimensional array, the first dimension being
an Integer and the 2nd dimension another data type, say string?
Or, is this a bad choice and a dataset may be a better way of handling
multi-dimensional data where the data types may not be the same?
venki
| |
by: per9000 |
last post by:
Hi all,
I have a two-dimensional array of data, f.x int's. We can imagine that
the array is "really large". Now I want the data in it and store this
in a one-dimensional array.
The obvious way to do this is a nested for-loop - but we all know
O(n^2) is bad. So I am looking for something like ArrayList.ToArray(),
or Matlabs A(:).
C#
|
by: gianluca |
last post by:
Hy list,
I've to declare a 3D matrix in C . I tried with that code:
double ***mat;
mat=(double***)G_malloc(ndimension*(sizeof(double));
but the program send me a run time error.
|
by: vippstar |
last post by:
The subject might be misleading.
Regardless, is this code valid:
#include <stdio.h>
void f(double *p, size_t size) { while(size--) printf("%f\n", *p++); }
int main(void) {
double array = { { 3.14 }, { 42.6 } };
f((double *)array, sizeof array / sizeof **array);
return 0;
|
by: =?Utf-8?B?SGVucmlrIFNjaG1pZA==?= |
last post by:
Hi,
consider the attached code.
Serializing the multi-dimensional array takes about 36s
vs. 0.36s for the single-dimensional array.
Initializing the multi-dimensional array takes about 4s
vs. 0.3s for the single-dimensional array.
(I know initializing is not necessary in this simple example,
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |