Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. existing code from c++

existing code from c++

Scheduled Pinned Locked Moved C#
csharpcomc++debugging
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stonee74
    wrote on last edited by
    #1

    Hi There, I hope somebody can give me some good advices: I need to use an existing Programming Interface which is available whether as a 'COM object dll' or' 2 C++ header files' under .NET. I used the COM object, this works quite nice in VB.NET and as well in C#, using the System.Runtime.InteropServices.TypeLibConverter class. In fact everything will be done automatically and i can use my Interface like in the unmanaged world, great! The main problem is, I develop an application on a PocketPC, under the .NET Compact Framwork. Since this System.Runtime.InteropServices.TypeLibConverter class does not exist under the .NET CF, i need to use the C++ interface, but this gives me headache. So far I found out the following: 1)use (unmanaged) C++ Code in the managed world of .NET 2)use the built-in .NET runtime interop facilities to talk directly to the existing code. 3)wrap the code using the managed extensions to C++. 4)rewrite the code in a .NET language. I wanted to go in direction 4) originally, but I'm no longer sure what makes really sense on this one... My interface is consisting of 3 header files. 2 of them are simply describing enumerations and structs. The third one consists of helper classes in C++ which are easing the use of this interface a lot. I assume that when I would go the wrapping way, that I would only need to wrap the classes I directly touch from my App in c#? If yes then I woud need to wrap only 2 classes? What way to go would be the best, wrapping interop, rewrite? But how would I do that best? Could somebody give me an idea how to do that? Thanks a lot, stonee Attached the sample classes: //sender.h Class1 to wrap: // Macro to compact duplicate code #define DATA_PACKET &Data.DataPacket, sizeof(Data.DataPacket) class Command { public: CESAPICommand() {TRACE(_T("CESAPICommand()\n"));} virtual bool SendPacket(void* PacketStart, long PacketSize) { TRACE(_T("Virtual SendPacket() called!\n")); return false; }; // Send commands bool inline Init() {CInit Data; return SendPacket(DATA_PACKET);} bool inline SetBox(double dX1, double dY1, double dZ1, double dX2, double dY2, double dZ2) {CSetBox Data(dX1, dY1, dZ1, dX2, dY2, dZ2); return SendPacket(DATA_PACKET);} }; Class2 to wrap: ///Receiver.h class Receive { public: Receive() {TRACE(_T("Receive()\n"));} protected: bool ReceiveData(void* packetStart, long packetSize) { if (packet

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups