Can I do this?

  • Thread starter Beatrice Rutger
  • Start date
B

Beatrice Rutger

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.
 
W

William DePalo [MVP VC++]

Beatrice Rutger said:
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/csharp09192002.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
 
J

Jochen Kalmbach [MVP]

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

--
Greetings
Jochen

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

Beatrice Rutger

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.
 
W

William DePalo [MVP VC++]

Beatrice Rutger said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top