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

S

Slickuser

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!");
}

}
}
 
R

red floyd

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
 
S

Slickuser

Is there any example? Guess google will do.

(e-mail address removed):












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.
 
A

Aziz Azizi

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!");
        }

    }



}

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,078
Latest member
MakersCBDBlood

Latest Threads

Top