A
ajtaylor
Hello,
I wonder if anyone can help lift the cloud of confusion hanging over me
at the moment ;-)
I have a load of unmanaged code in a project that I am compiling NOT
USING /CLR
I have some managed code and I want to call some of the functions in
the unmanaged code. So I create a file with mixed C++ and C++/CLI code
Now, the function signatures of the unamaged code contain
structures/classes that are declared in their own headers
//Unmanaged....
struct someData
{
int a;
double b;
};
struct bigstruct
{
//lots of data......
};
funcDoSomething(std::vector<somedata>& data, bigStruct* bigstruct)
{
.....
}
In the managed/mixed code I #include the appropriate headers and go
about constructing the data into the unmanged C++ structs [from managed
data types say from a Form] so that I can call the functions....
this will involve push_back calls onto a vector and newing in a struct
on the unmanaged HEAP.
What my question is - if I compile the code with /CLR - what actually
is going on behind the scenes - is the compiler turning the C++ code
into MSIL?? If so how does this fit in with using things like a call to
"new" and std::vector.
Do I have to pin the vector before passing it to the function??
Is it ok to just pass in the pointer to bigStruct??
Is there a performance hit from following this approach?
Is this indeed the correct approach to take?
Many thanks for any help you can offer me.
I wonder if anyone can help lift the cloud of confusion hanging over me
at the moment ;-)
I have a load of unmanaged code in a project that I am compiling NOT
USING /CLR
I have some managed code and I want to call some of the functions in
the unmanaged code. So I create a file with mixed C++ and C++/CLI code
Now, the function signatures of the unamaged code contain
structures/classes that are declared in their own headers
//Unmanaged....
struct someData
{
int a;
double b;
};
struct bigstruct
{
//lots of data......
};
funcDoSomething(std::vector<somedata>& data, bigStruct* bigstruct)
{
.....
}
In the managed/mixed code I #include the appropriate headers and go
about constructing the data into the unmanged C++ structs [from managed
data types say from a Form] so that I can call the functions....
this will involve push_back calls onto a vector and newing in a struct
on the unmanaged HEAP.
What my question is - if I compile the code with /CLR - what actually
is going on behind the scenes - is the compiler turning the C++ code
into MSIL?? If so how does this fit in with using things like a call to
"new" and std::vector.
Do I have to pin the vector before passing it to the function??
Is it ok to just pass in the pointer to bigStruct??
Is there a performance hit from following this approach?
Is this indeed the correct approach to take?
Many thanks for any help you can offer me.