Forums

Why is Mdbg starting in MainWrapper.cobra?

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Why is Mdbg starting in MainWrapper.cobra?

Postby Gameday » Sat May 08, 2010 2:33 am

I tried to do some debugging on another computer. Here's a small source file which can reproduce the problem:

Code: Select all
class A
    def main
      a = CobraCore.commandLineArgs
      for i in a
         print i


and the output I get when I try to run it:

Code: Select all
F:\Documents and Settings\john\Desktop>cobra -d -compile x.cobra
Compilation succeeded

F:\Documents and Settings\john\Desktop>mdbg x.exe
MDbg (Managed debugger) v3.5.30729.1 (SP.030729-0100) started.
Copyright (C) Microsoft Corporation. All rights reserved.

For information about commands type "help";
to exit program type "quit".

run x.exe
STOP: Breakpoint Hit
located at line 1 in MainWrapper.cobra
[p#:0, t#:0] mdbg>


the name of the file is x.cobra
Gameday
 
Posts: 27

Re: Why is Mdbg starting in MainWrapper.cobra?

Postby Gameday » Sat May 08, 2010 2:50 am

Very interesting. If I add is shared to main, it will start normally. Any ideas why?
Gameday
 
Posts: 27

Re: Why is Mdbg starting in MainWrapper.cobra?

Postby Charles » Sat May 08, 2010 3:37 am

Cobra let's you have a .main method that is not shared/static. But this is a feature of the language that is not shared by the virtual machine (VM). So when your .main is not shared, Cobra creates a MainWrapper class to appease the VM gods:
class MainWrapper

def main is shared
YourProgram().main
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Why is Mdbg starting in MainWrapper.cobra?

Postby Gameday » Sat May 08, 2010 4:07 am

Ah, ok. I understand now. Thanks!
Gameday
 
Posts: 27


Return to Discussion

Who is online

Users browsing this forum: No registered users and 46 guests