Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C++ call C# .NET api (dll)

16 views
Skip to first unread message

Slickuser

unread,
Dec 23, 2009, 6:51:03 PM12/23/09
to
Hi,

I have two projects, one wrote in C++ and one in C# .NET 3.5 Framework
sp1.

I would like the C++ project to call C# project dll. How can I expose
api/function from C# to allow C++ to call. Mostly I will not have the
source code to C# project, just api I can call.

Example of C# file below so I can get something going. Any help?


Test.cs
using System;
using System.Collections.Generic;
using System.Text;

namespace ProjectX
{
public class Test
{

public static void Main()
{
Console.WriteLine("Main!");
}

public void TestCount()
{
Console.WriteLine("Count!");
}

}
}

red floyd

unread,
Dec 23, 2009, 10:12:44 PM12/23/09
to
On 12/23/2009 3:51 PM, Slickuser wrote:
> Hi,
>
> I have two projects, one wrote in C++ and one in C# .NET 3.5 Framework
> sp1.
>
> I would like the C++ project to call C# project dll. How can I expose
> api/function from C# to allow C++ to call. Mostly I will not have the
> source code to C# project, just api I can call.
>[redacted]

Wrong group. Try one with "visual studio" or "dotnet" in it's name

yqever

unread,
Dec 24, 2009, 8:41:35 PM12/24/09
to
Slickuser <slick...@gmail.com> wrote in news:67bcda21-99f8-45a5-80c9-
179825...@d9g2000prh.googlegroups.com:

two ways:

1. Write your C# dll as COM.

2. Use managed C++.

If you don't have C# code, just use managed C++ to call it.

Slickuser

unread,
Dec 24, 2009, 9:10:24 PM12/24/09
to
Is there any example? Guess google will do.

On Dec 24, 5:41 pm, yqever <yqe...@163.com> wrote:
> Slickuser<slick.us...@gmail.com> wrote in news:67bcda21-99f8-45a5-80c9-
> 179825562...@d9g2000prh.googlegroups.com:

Aziz Azizi

unread,
Dec 26, 2009, 3:32:04 PM12/26/09
to

Hi;
if you want to call API by programming in C++ I can send you some
project.

0 new messages