This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Binary serialization/de-serialization in C++ and C#
I am working on a project where server is written in C++ (boost is extensively used) and the client application is written in C#. I am facing the problem while serializing/deserializing messages between client/server.
I have studied various alternative libraries for achieving this sort of cross-platform serialization, and Protocol Buffers seems to be the best... but it does not support serialization of the standard library's map container and boost::shared_ptr.
My question then, is:
Can someone explain how map and boost::shared_ptr could be serialized using Protocol Buffers. Or failing that,
Would Apache's Thrift work for this?
...Or am I stuck using interop DLLs on the (C#) client side?
What about wrapping the c++ message classes with c++/cli ref classes so that you use the same boost serialisation library on the client side.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
UPDATE:
1 - New C# application exposes NamedPipeServerStream(System.IO.Pipes) on .Net framework.
2 - Legacy VB6 needs to communicate with the C# NamedPipeServerStream.
3 - Until now VB6 resides in a system without .Net framework. But, going forward both C# and legacy application will be on a computer which has .Net installed.
3 - Can VB6 talk to the C# pipe server using CallNamedPipe() and is this approach hassle free in maintenance of the communication betwen the applications?
Any resources I can look into or other approaches ?
Old question:
I have a legacy VB 6.0 application which needs to communicate with a newer C# application using .Net NamedPipes.
Currently, the legacy VB6 application sits on a system without .Net.
When I install .Net framework and the C# NamedPipeServer application on that system, how can the legacy VB6 program communicate with the C# application over NamedPipes ?
Please let me know.
Thanks in advance.
I have worked with a VB6 application which needed data from a set of WCF services.
The easiest way to achieve this is to put the logic to communicate with remote systems in a .Net assembly which exposes operations via COM and call that assembly from your VB6 code.
See https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comvisibleattribute(v=vs.100).aspx as a starting point.
If you are using System.IO.Pipes for this then thankfully you don't have to deal with the cruft and interoperabiity nightmare known as WCF.
To write a nice pipe client in VB6 requires a control or class written in C++ in order to manage the async I/O and raise events. Otherwise you will probably have to use a Timer to poll for input, but it is all fairly straightforward API I/O then.
I don't know of any cheap or free ActiveX DLL or OCX generally available today, and I doubt Microsoft ever produced one. But the Timer-driven polling approach should have plenty of examples out there to get you started. And it spares you the terrible inefficiency, stops and sputters, and giant memory footprint of saddling your VB6 program with all the overhead of using .Net Interop.
But that is always an option.
This question already has answers here:
Strategy for cross-language (java and c#) object serialization
(9 answers)
Closed 9 years ago.
I am a .Net developer who looks a bit at android (using Android Studio). For my Android App I wrote some additional Tools (.NET/Windows) that allow me to save Data in XML-files which contain complex serialized objects created by standard Framework-Methods.
Can I read serialized objects created by the .NET-Framework directly into Android applications? If not: Is there any workaround to "convert" these files?
There are many ways to do this. A schema may help, depending on approach. One quick/simple way to make POJO from XML on android is to use the simple framework. It takes some extra time to create the class with right extra decoration, then framework will push/pull XML to POJO. Other ways are to use other 3rd party tools to take the XML (or schema) to generate the java classes and what not, but the overhead of deserialization and/or Android availability of the JARs etc may be a headache. That's why/how I ended up using the simple framework.
This question already has answers here:
How do I move from Java to C#?
(9 answers)
Closed 5 years ago.
I am going to start work with a company that works on a .NET framework and i am a professional java developer and i think i should switch to .NET because i cant see any bright future with java anymore.
My questions:
Now i have decided to move to .NET, what things i should learn as a total beginner. Should i learn C# or i should understand basics of .NET first?? as i know only that .Net is a framework and c# is one of language run on it. I am only interested in C# as it like java not in VB or any other.
please tell me what i am suppose to learn and please refer to me some books.
thanks
You are correct in your understanding that .Net is the underlying portable framework which is supported via multiple languages such as C#,VB etc. If you are looking for a Java equivalent in terms of programming language then C# is exactly what you want to be working with.
One of the best books for C# out there is C# via CLR that teaches you C# with an understanding of the underlying CLR. It is more of an intermediate-advanced proficiency book but the basics should be easy to latch on to given your Java background.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Using C++ Class DLL in C# Application
I try to failed to add reference to add c++ dll in c#
if you have any other method to add or use c++ dll in c#. how can we use?
Where do i mistake to add dll in my c# project?
Thanks in advance
For using native C++ libraries in C#, you mostly will have to create a C++/CLI wrapper for that. P/Invoke is ok as long as the API of your DLL contains just simple C-like functions, but when the API contains real C++ classes, C++/CLI ist much better for that task.
You don't add a reference to a C++ library, that's for .NET assemblies only. What you need is platform interop using P/Invoke. MSDN has a bunch of information here:-
http://msdn.microsoft.com/en-us/library/aa288468(VS.71).aspx
It basically means you have to write method stubs that call your exported functions in the external library.
There is also the C++/CLI way which can be better depending on your C++ project setup, but personally I prefer the traditional Windows API function export way.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
is there an effective tool to convert c# to java?
I'm not very experienced with Java and have a lot of C# that I would like to translate into Java syntax so it would become compilable.
Reason: Android and Google Cloud
I know the API/Platforms have different structures, but lets say we dont need a 100% compability, but just to get "core functionalitet" translated. The GUI itself is one story of its own, as I've learned. But instead of rewriting every SWITCH-CASE, rebuild every Class etc. it would be nice to "map" the objects to Java equals and then do a recompile on the Android/Google platform.
I am sure there would be something that cant be translated as its a "C# only thing" - but just like every language is possible to generate .NET/MONO I thought there might be a Java -> .Net available too and therefore also a decompiler kinda thing?
So are there any easy ways to overcome this translation by Frameworks, SDK or other similar methods that will take 80-95% of the task automatically?
Have a look here: JSC.
But beside, there are some c# concepts which don't easyli translate into java.
.NET and Mono are compatible because both are VMs that run C# code. Grasshopper claims to allow you to run .NET classes on the JVM, but I haven't used it. It won't work at all for Android because Android isn't the JVM, but rather Dalvik.
The differences between C# and Java are more than "structural" as you put it, and translating from one language to another is more complicated than I think you understand.
I know Microsoft has a tool that's supposed to help convert Java to C#, but considering that a great many java applications reference libraries outside of the main system (apache being the most prominent example) this type of tool would be a monumental task.
C# also has data types that aren't supported at all in Java, such as unsigned types and stack-allocated objects. Writing translations from CLR to Java bytecode would be difficult indeed. And if you're using lambda functions in your code, kiss this idea goodbye.
Then there's the fact that not all language features in Java are available to the Davlik JVM.
I'm not a microsoft fanboy, but here's a comparison of the two languages that will give you an idea why I doubt this tool exists.
http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java