So I have this CLR wrapper cpp file: #using <System.dll> // Reference to System.dll…
Jump to turn (11)
- 1So I have this CLR wrapper cpp file: #using // Reference to System.dll #using //
- 2can you show all the files needed again
- 3so where's the actual C# dll?
- 4im confused, clrwrapper.cpp is using itself? clrwrapper.dll?
- 5so there's no need to have a C# DLL? just a clr and the c code?
- 6yes but the use case here is im trying to wrap an existing C# dll and this is a
- 7what does clrwrapper.h contain?
- 8ok compiling the wrapper i get this: wrap.cpp wrap.cpp(8) : error C2732: linkage
- 9wrap.cpp wrap.cpp(16) : error C2732: linkage specification contradicts earlier s
- 10so what does main.c look like now with these changes
- 11main.obj : error LNK2019: unresolved external symbol impCoUninitialize@0 referen
- User
So I have this CLR wrapper cpp file:
#using <System.dll> // Reference to System.dll #using <async.dll> // Reference to the C# assembly
using namespace System; using namespace System::Threading::Tasks;
public ref class Wrapper { public: Wrapper() {}
codeTask<String^>^ CallAsyncOperationAsync() { MyCSharpDLL::AsyncOperations^ asyncOperations = gcnew MyCSharpDLL::AsyncOperations(); return asyncOperations->SimulateAsyncOperationAsync(); }};
and this is the C# dll:
using System; using System.Threading.Tasks;
namespace MyCSharpDLL { public class AsyncOperations { public async Task SimulateAsyncOperationAsync() { await Task.Delay(2000); // Simulate a 2-second asynchronous operation return "Async operation completed!"; } } }
how do I use it in my main.c program below?