class Test
def init
.doSomething
def doSomething
print 'do something'
Cobra doesn't have the native DLL import feature of C#, so you either have to include C# code in your files, or you have to create a managed DLL wrapper. To include C# code directly, the command line would be something like:
- Code: Select all
cobra -c MyProg.cobra SharpLib.cobra SharpLib.cs
Where SharpLib.cs contains your DllImport declarations and SharpLib.cobra informs the Cobra compiler what's in there:
class Util
is extern
shared
def theFunction(aVariable as String, anotherVariable as int)
pass
Another option is to have a little C# project that creates a DLL and then incorporate that DLL in your Cobra project. You can ref it on the command line:
- Code: Select all
cobra -ref:MyLib.dll -c MyProg.cobra
Or just "use" it:
use MyLib
# or
use MyLib from 'MyLibFilename'
That last example only works if you're using Cobra out of the Subversion workspace, otherwise you must have both -ref: and "use".