T
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
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