473,473 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Passing an array between VB.Net and C++ and back

T
I am working on a project that requires VB.Net code in one project in the
solution to call C++ code in another project in the same solution.

I have already figured out that I have to set up the C++ class like this:
Header file-

typedef unsigned char u8;
typedef unsigned int u32;

Cpp file-

__gc public class TpcTool
{
protected:
TpcTool(){
}

public:
u32 bgra32_to_rgba32(u32 color) {
return color & 0xFF00FF00 | (color&0x00FF0000)>>16 |
(color&0x000000FF)<<16;
}

u8 * foo(u8 u) {
return &u;
}
};
and that I have to add a reference to the C++ project in my VB project. I
can "see" (via Intellisense) the
bgra32_to_rgba32() function but the second one yields an error message that
indicates that "foo has an incompatible return type..."
when I write this:

Dim v As TpcTool
v.foo(CByte(32))

The second function is not really what I'm trying to do, I just tried
something simple to see why I couldn't
return an array to my VB code.

Any ideas how to go about calling C++ routines that need to process and
array of bytes and return the same?

Thanks in advance to anyone who can render assistance!

Tom Luetz II
Nov 20 '05 #1
1 1772
"T" <tl****@comcast.net> schrieb
u8 * foo(u8 u) {
return &u;
}
};
and that I have to add a reference to the C++ project in my VB
project. I can "see" (via Intellisense) the
bgra32_to_rgba32() function but the second one yields an error
message that indicates that "foo has an incompatible return
type..." when I write this:

Dim v As TpcTool
v.foo(CByte(32))

The second function is not really what I'm trying to do, I just
tried something simple to see why I couldn't
return an array to my VB code.


First, I probably can't help you. Yet ...

- Is it a managed assembly you created in C++? Otherwise it wouldn't be
possible to set a reference.
- I think an U8* is not CLSCompliant
- If you won't get an answer here =>
microsoft.public.dotnet.framework.interop
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

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

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
17
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
0
by: =?Utf-8?B?QmlsbHk=?= | last post by:
Hi, VS 2005/.NET 2.0 In my DAL i am running a query and passing the results into a local array. That array is being passed back to the BAL and through to the Presentaltion layer. Now, i would...
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
jinu1996
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...
0
tracyyun
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...
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...

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.