L
L
lPestl2016-11-06 12:20:12
Facebook
lPestl, 2016-11-06 12:20:12

How to use namespace/classes/class methods from a third-party dll compiled in C# in a C++ project?

If described in a more general case, then the essence of the problem is as follows:
There is a C# project that contains a namespace with classes. Builds a dll project. And there is also another, third-party project in C ++, in which you need to use these namespace and classes and use class methods. How to do it? How to connect the dll so that the project sees the classes?
And if you need a more specific example, then I’ll clarify:
It is necessary to tie the facebook api to the application on the unreal engine so that it works on a PC. I found a hint somewhere on the forums. I found and compiled the Facebook C# SDK: https://github.com/facebook-csharp-sdk/facebook-cs...
I got a dll as the output. I threw the dll into the plugins folder of the project on the Unreal engine. Similar to this methodI get DLLHandle , but I don't know how to get the necessary classes out of there. The example describes only the option with functions. Prompt how having handle dll to use classes and methods in C++/C++ unreal.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2016-11-06
@Nipheris

Methods and classes in dotnet assemblies have as much in common with classes in C++ as do Java classes. Those. in general, nothing. To access them from the same process, you need to take the CLR, run it and load the assembly you are interested in there. The fact that dotnet assemblies have a DLL extension should not confuse you - this is done for compatibility in some scenarios, the assemblies themselves bear little resemblance to DLLs.
In total, you have 3 options:
1) write a small application in Sharp, perform the necessary actions from it using the Facebook C# SDK, and interact with it from the main project via IPC. Then you don’t have to run the CLR yourself, it will be enough to run this dotnetov EXE-shnik;
2) study the API of one of the .net runtime implementations (.net framework, .net core, mono), under which the Facebook SDK is able to work, and use this API to run the runtime within your C ++ application;
3) use the documentation for the Facebook REST API and write the client yourself in C ++ and forget about the library you specified.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question