Home compiling C code and C# code both into .NET DLL
Reply: 1

compiling C code and C# code both into .NET DLL

Krischu
1#
Krischu Published in 2017-11-14 16:10:00Z

This question already has an answer here:

  • Embedding unmanaged dll into a managed C# dll 5 answers

I have a C# .NET DLL (call it CS_Code.dll) which is using

[DllImport("C_Code.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]

C_Code.dll contains mainly C code in extern "C" clauses.

When I will be using this assembly (CS_Code.dll) later in a project. I want to save from having to deliver two DLLs. All should be in one DLL.

Would it be possible to include (compile) the C-code into the .NET (e.g. as a library) making one .NET DLL out of it?

Lloyd
2#
Lloyd Reply to 2017-11-14 16:14:40Z

You can create a mixed-mode assembly which contains both native and managed code, however it's quite a topic so I suggest you read the section about it here on MSDN:

Mixed (Native and Managed) Assemblies

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.339555 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO