Hello,
I have a scenario where my CPP project is not compiled with CLR support,
but some of the CPP files have the /clr option set. In file1.cpp, the /clr
switch is not set. In file2.cpp, the /clr switch is set. file2.h is the
header for file2.cpp, and this header is included in file1.cpp. file2.h
contains method signatures containing only native types, including some
funtions which take a CString parameter or a const pointer to char, e.g.
void MyFunc (const char* param);
Methods in file1.cpp calls the functions declared in file2.h (and
implemented in file2.cpp), including the two with a CString and const pointer
to char parameters. My question is, should I be doing any marshalling of
data at this point (presumably in file1.cpp) when moving from native to
managed code? If so, what type of marshalling should I do and how?
Thank you,
Notre
David Lowndes - 26 Oct 2006 21:11 GMT
>My question is, should I be doing any marshalling of
>data at this point (presumably in file1.cpp) when moving from native to
>managed code?
No, it should just work seamlessly.
Are you having a problem?
Dave
Notre Poubelle - 26 Oct 2006 22:15 GMT
Hi David,
No, I'm not seeing any problem. I just thought that when passing
non-primitive values from native to managed code I would need to do some type
of marshalling.
The compiler does complain when trying to use native & managed types that
don't match. However, the compiler doesn't catch the case where native code
holds a reference to a managed object, which can be garbage collected if not
pinned. I thought there might be something I need to do in the scenario I
described earlier as well (but don't know what)...
Notre
David Lowndes - 27 Oct 2006 00:35 GMT
>Hi David,
>
>No, I'm not seeing any problem.
That's always reassuring :)
>I just thought that when passing
>non-primitive values from native to managed code I would need to do some type
>of marshalling.
I won't pretend to know what goes on since I've not yet needed to
know, but one of the essential points of the C++ compiler was that it
should just work (the old IJW "It Just Works" TLA) with /clr.
Dave
P.GopalaKrishna - 18 Jun 2007 18:08 GMT
Hello,
Please check if the post at:
http://blogs.msdn.com/gpalem/archive/2007/06/18/having-hard-time-marshalling-par
ameters-from-c-to-net.aspx
is useful.
P.Gopalakrishna.
http://www.geocities.com/krishnapg/
> Hello,
>
[quoted text clipped - 15 lines]
> Thank you,
> Notre