0

I am creating delegate in C#. C# solution is class library means using dll in different application.

In C# I want to invoke C++ method(method defined by another programmer), this methods need to call on runtime. For that I am using delegate, but I don't know how to use delegate in C# and how to store C++ function details for that delegate.

below one is the high level requirement :

  1. Create C# DLL
  2. Import that DLL into C++ application.
  3. Call C# methods from C++ application code.
  4. During step 3, while invoking C# methods for particular case I needs to call C++ method for that I am using delegate. Please let me know other best approach as well.

From above mentioned steps, till step # 3 I am able to code it. For that used one of solution mentioned in below link :

How to call a C# library from Native C++ (using C++\CLI and IJW)

  • 2
    Possible duplicate of [How to use \[DllImport("")\] in C#?](https://stackoverflow.com/questions/19450783/how-to-use-dllimport-in-c) – X39 May 14 '19 at 13:07
  • Below on is high level logic i am working : in C++ void onStartUp() { //................... } in C# class myDeleagte { public Action onStartUpDelegate; if (request.contains("StartUp")) { //Call C++ method stored in onStartUpDelegate Action variable. } } – Akshay Sheth May 14 '19 at 13:09
  • https://xaviergeerinck.com/binding-cpp-with-dotnet-core – alon May 14 '19 at 14:19

0 Answers0