Building and Using a dll
Posted: Thu Feb 14, 2008 7:04 pm
I ran into a bit of difficulty trying to build a dll that could be used by referencing it with the -r: option.
I created a file to be used as a dll called Test1.cobra
Then I created a file to use Julie and George called Test2.cobra
When built together using the -files: option, everything worked as expected.
The way I got them to build independently was:
Building Test1 without -ert:no resulted in redefinition of CobraImp and Tracer errors when I built Test2.
Building Test1 without -ert:no and Test2 with -ert:no resulted in:
error: COBRA INTERNAL ERROR / ArgumentException / An element with the same key already exists in the dictionary.An element with the same key already exists in the dictionary.An element with the same key already exists in the dictionary.An element with the same key already exists in the dictionary.
I created a file to be used as a dll called Test1.cobra
namespace Bob
class Julie
pass
class George
pass
Then I created a file to use Julie and George called Test2.cobra
use Bob
class Program
def main is shared
print Julie()
print George()
When built together using the -files: option, everything worked as expected.
The way I got them to build independently was:
- copy Cobra.Lang.dll to the local directory
- cobra -t:lib -ert:no Test1.cobra
- cobra -r:Test1.dll Test2.cobra
Building Test1 without -ert:no resulted in redefinition of CobraImp and Tracer errors when I built Test2.
Building Test1 without -ert:no and Test2 with -ert:no resulted in:
error: COBRA INTERNAL ERROR / ArgumentException / An element with the same key already exists in the dictionary.An element with the same key already exists in the dictionary.An element with the same key already exists in the dictionary.An element with the same key already exists in the dictionary.