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 / Languages / Managed C++ / June 2005

Tip: Looking for answers? Try searching our database.

Can I do this?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Beatrice Rutger - 06 Jun 2005 14:13 GMT
Hi,

I want to use Net Forms (I think thats what theyre called) to build a
really sexy, cool front end - but then use Visual C++ (not VC++ .NET -
because I want native code, not IL) to create a "blisteringly" fast
application with a cool front end.

One reason why I don't want the CLR code is because it is relatively
easy to reverse engineer the code, plus I don't really like the idea of
interpreted code at all (call me old fashioned) - but the real reason is
security - I do not want my proprietary algorithms to be easily
available for all to see (not impressed by code obfuscators - they are
either too bugy, cause more problems than they solve, or are fairly easy
to de-obfuscate code they obfuscated - so No thanks its native code for me.

To recap, this is what I want to do:

1). Design GUIs using .Net Forms
2). Write client applicationb logic in C++
3). Compile code into a native binary (or at the very least, my C++ code
will not be "easily reversible" from the resulting executable

Can I do this?. If yes, please tell me how it can be done.

look forward to your response

B.
Jochen Kalmbach [MVP] - 06 Jun 2005 14:53 GMT
Hi Beatrice!
> One reason why I don't want the CLR code is because it is relatively
> easy to reverse engineer the code, plus I don't really like the idea of
> interpreted code at all

WHat code is interpreted? IL is jitted.. (and so compiled at runtime).
You also can use "ngen"; but the improvement is minimal (or even worser).

>(call me old fashioned) - but the real reason is
> security - I do not want my proprietary algorithms to be easily
> available for all to see

My suggest is: DO your fancy-sexy UI with C# and do your algorithm in
unmanaged C++ (DLL) and use PInvoke.

> 1). Design GUIs using .Net Forms

Do it via C#.

> 2). Write client applicationb logic in C++

Do it in unmanaged C++ and use PInvoke to call it from C#.

> 3). Compile code into a native binary (or at the very least, my C++ code
> will not be "easily reversible" from the resulting executable
>
> Can I do this?. If yes, please tell me how it can be done.

Yes. See above...

Signature

Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/

William DePalo [MVP VC++] - 06 Jun 2005 14:53 GMT
> I want to use Net Forms (I think thats what theyre called) to build a
> really sexy, cool front end - but then use Visual C++ (not VC++ .NET -
> because I want native code, not IL) to create a "blisteringly" fast
> application with a cool front end.

OK.

> Can I do this?. If yes, please tell me how it can be done.

Yes, sure. You'll need to decide if the native parts of the application run
in process with the managed parts or not.

If the native parts run in process then you can create one or more DLLs
whose exports you call from your forms by means of the Platform Infovke
(P/Invoke) capability:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/cs
harp09192002.asp


http://msdn.microsoft.com/msdnmag/issues/03/07/NET/

http://msdn.microsoft.com/msdnmag/issues/04/10/NET/

The links I chose all show how C# card can invoke native code because often
that's what people want to do. You can use P/Invoke from any .Net language.

If the native parts run out of process then you can use some IPC technique
to hop the fence - e.g. sockets.

Regards,
Will
Beatrice Rutger - 06 Jun 2005 15:28 GMT
Hi William,

Many thanks for the prompt feedback and links. I will be reading them in
greater detail shortly. I have a couple more questions:

1). I quickly perused through the links you kindly provided - and I came
accross the dreaded word of "marshalling" - why are we marshalling data
if it we are running in the same process - (is data representation
between C++ and Managed C++ so different as to require in-process
marcshalling?). Is there any documentation you aware of that talks about
the performance hit due to marshalling?

2). My backend is pure java (J2EE app running on Linux). I have made the
decision to use.NET as the client app (front end) because SWING sucks
big time.  I was wondering if you have any suggestions on how to
communicate between the backend and the frontend. I can't use XML
because it is too heavyweight and I will incur performance hits (parsing
related) on both sides. I was thinking of using a servlet layer on the
server side and then use HTTPS requests from the client to send base 64
encoded data from the server - This will allow me to receive files
stored at the backend server in Linux (MSB format). Do you have any
suggetsions/comments on how I can do this base 64 encoded HTTP comms
from the client side (or maybe another suggestion of how to communivcate
between the backend and frontend)

I look forward to your feedback.

Tkx

B.

>>I want to use Net Forms (I think thats what theyre called) to build a
>>really sexy, cool front end - but then use Visual C++ (not VC++ .NET -
[quoted text clipped - 26 lines]
> Regards,
> Will
William DePalo [MVP VC++] - 06 Jun 2005 18:03 GMT
> Many thanks for the prompt feedback and links.

You are welcome.

> 1). I quickly perused through the links you kindly provided - and I came
> accross the dreaded word of "marshalling" - why are we marshalling data if
> it we are running in the same process - (is data representation between
> C++ and Managed C++ so different as to require in-process marcshalling?).
> Is there any documentation you aware of that talks about the performance
> hit due to marshalling?

Well, you are dealing translating objects in different type systems. And as
for the preformance hit, hopping the fence between the two environments is
not free. The rule of thumb is to minimize transitions betwwen environments
and do as much on each side of the boundary as  is practical. I don't have
any numbers or links to them. Perhaps someone else does.

> 2). My backend is pure java (J2EE app running on Linux). I have made the
> decision to use.NET as the client app (front end) because SWING sucks big
> time.  I was wondering if you have any suggestions on how to communicate
> between the backend and the frontend.

It is not the kind of thing I do on a daily basis. I'd Google for

   web services j2ee

or

   .Net j2ee bridge

or something like that to start researching products or technologies.

> Do you have any suggetsions/comments on how I can do this base 64 encoded
> HTTP comms from the client side (or maybe another suggestion of how to
> communivcate between the backend and frontend)

That's not something I have had to do either. Perhaps someone else has a
suggestion.

Regards,
Will

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.