Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / January 2007

Tip: Looking for answers? Try searching our database.

String conversion b/t C# and native C++

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mtv - 31 Jan 2007 20:40 GMT
This question is probably already out there, but there's none I could find
for my scenario.

My C++ code has: CFunction(const char* data);
My C# code references C++ dll and needs to call this function. What data
type in C# is it for "data"? I think it will work w/ sbyte*, but then, how do
I create such datatype in C#?

Any working solutions are appreciated.

Thanks.

Signature

Your 2 cents are worth $milion$. Thanks.

mtv - 31 Jan 2007 21:22 GMT
Maybe it's worth to notice that I use IJW method to create a __gc C++ wrapper
around native C++ class. Then, I reference the C++ managed dll (wrapper) from
my C# project. So:

C# references and calls C++ wrapper (Managed) that in turns calls native C++
object (__nogc in the same dll w/ C++ wrapper class). In terms of calling
procedure:

__nogc C++  class has: public CallingFunction(char* data);
__gc C++ class has: (1) reference to __nogc class and (2) public
ManagedCallingFunction(char* data) { pUnmanaged->CallingFunction(data); }
C# class: MyManagedObj.ManagedCallingFunction(dataParam).

What data type of dataParam should it be? Compiler seems not to like string
and ask for sbyte*. How do I create sbyte* or anything compatible?

Thanks.

--Your 2 cents are worth $milion$. Thanks.

> This question is probably already out there, but there's none I could find
> for my scenario.
[quoted text clipped - 7 lines]
>
> Thanks.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.