Thread: Call managed code (c#) from unmanaged code (VC++ 6.0)

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    1

    Call managed code (c#) from unmanaged code (VC++ 6.0)

    Hi

    Please excuse my english. I'm from germany.
    Does anybody know if it's possible to call managed code (c#) from VC++ 6.0? I already found the ManWrap Library, but this library does not work with VC++ 6.0.

    I hope somebody knows an alternative.

    Thank you very much in advance

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    I've never tried, but I would guess the only way it could work is if it used an extern "C" interface with primitive data types. Otherwise the ABI would be incompatible.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    To call managed code, you need to create an ActiveX wrapper for the .Net component. I'm not sure how automated this works - it should be pretty simple.

    Once you've got the wrapper, you can use classical COM mechanisms to use it.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    A word of warning, outside of using a COM intermediary or similar there is not a whole lot of interaction that can be done between managed and unmanaged objects themselves. .NET doesn't like you trying to introduce foreign data into its internally controlled objects.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help calling function is asm
    By brietje698 in forum C++ Programming
    Replies: 24
    Last Post: 12-06-2007, 04:48 PM
  2. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  3. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 12:51 PM
  4. Replies: 0
    Last Post: 02-21-2002, 06:05 PM
  5. Pls help me to do this project in C I need source code
    By sureshmenon74 in forum C Programming
    Replies: 4
    Last Post: 10-04-2001, 06:57 AM