In order to create a DLL we will use a crude example (probably meaningless). But the important thing is to know the commands for create a DLL.
The DLL will be created from a simple class used to generate random numbers with congruential generators. What is most striking in the code is a class named
CongruentialGenerator with a the public method
MixedMethod and a read-only property named
Create the DLL
The way to create the DLL is with the next command:
gmcs /target:library /out:Rand.dll Random.cs . If you are using .NET Framework you must change
Calling the DLL
Now we can to call the DLL generated like a
The way to create a executable file is with the next command:
gmcs /reference:Rand.dll Main.cs. If you are using .NET Framework you must change
Now we simply run the Main.exe file generated:
mono Main.exe :
Now this DLL can be used by any other programming language running over .NET platform, e. g. IronPython, Visual C++, etc.