How can I export a Function from c# for c++ to use?

Posted on 2011-05-04
Last Modified: 2012-05-11
Hello Experts,

I need to give access tp my dll to a c++ program.  The dll is written in C# and is a form.

Basically I need to use something like " exported function ShowDialog(HWN hParent)" to be called from c++.

How would I do this?

Thank you
Question by:dbdp
    1 Comment
    LVL 30

    Accepted Solution

    Hi dbdp,

    I have to admit that I never did such befor so I have no experience with this, but AFAIK you can do this only using COM - here's a MSDN article about how to implement an interface in the C# DLL and how to use it via COM in the native C++ code:

    Hope that helps,


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now