DLLs, Namespaces and C# code
Posted: Sat Feb 09, 2008 12:26 pm
I received an email with these three questions, which I will answer here:
1) How can I have cobra generate a dll?
cobra -t:lib foo.cobra
2) Does cobra support namespaces?
Sure does:
3) Is there a way to preserve the generated C# code for education?
Yep. It's a command line option:
The files will be named "foo.cobra.cs" and "bar.cobra.cs". You only need one command. "-kif" is a synonym for "-keep...". Also, try out "cobra -h".
I've seen reports that Cobra programs are executing quite fast due to leveraging the C# compiler.
1) How can I have cobra generate a dll?
cobra -t:lib foo.cobra
2) Does cobra support namespaces?
Sure does:
use System.Net
namespace Cyberdyne.Skynet
class Data
var _foo # ...
3) Is there a way to preserve the generated C# code for education?
Yep. It's a command line option:
- Code: Select all
cobra -c -keep-intermediate-files foo.cobra bar.cobra
cobra -c -kif foo.cobra bar.cobra
The files will be named "foo.cobra.cs" and "bar.cobra.cs". You only need one command. "-kif" is a synonym for "-keep...". Also, try out "cobra -h".
I've seen reports that Cobra programs are executing quite fast due to leveraging the C# compiler.