Compdigitec Labs

« | Home | »

Linking a shared assembly in the Mono C# compiler

By admin | December 23, 2008

If you wrote a class in C++ and wanted to use it in many applications, you could simple #include it in each application you wanted to use it in. But if you wrote a class in C# and wanted to use it in many applications, you cannot just #include it, because there is no #include in the C# language! The solution to this is to reference the library. This article will show you in easy steps:

  1. After you have written the class, compile it into a library with “gmcs ClassXyz.cs -target:library” (replace ClassXyz.cs with your class’s filename)
  2. The command above should generate a shared library/assembly called ClassXyz.dll.
  3. Now you can compile the application with “gmcs ProgramXyz.cs -reference:ClassXyz.dll”.

If you found this article useful or helpful, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Linux | 8 Comments »

8 Responses to “Linking a shared assembly in the Mono C# compiler”

  1. เช่ารถตู้พร้อมคนขับ Says:
    January 14th, 2025 at 01:52

    … [Trackback]

    […] Read More Information here on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  2. รั้วสำเร็จรูปเชียงใหม่ Says:
    January 24th, 2025 at 21:59

    … [Trackback]

    […] Find More on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  3. som777 Says:
    January 25th, 2025 at 08:15

    … [Trackback]

    […] There you can find 94269 more Info on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  4. kc9 Says:
    January 26th, 2025 at 22:52

    … [Trackback]

    […] Find More Information here on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  5. stihl veikals Says:
    January 27th, 2025 at 17:02

    … [Trackback]

    […] Here you will find 80157 more Information on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  6. highbay Says:
    January 28th, 2025 at 01:49

    … [Trackback]

    […] Find More here to that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  7. โคมโรงงาน Says:
    January 30th, 2025 at 22:09

    … [Trackback]

    […] Information to that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  8. สกรีนแก้ว Says:
    February 11th, 2025 at 20:20

    … [Trackback]

    […] Find More to that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

Comments