0

.net applications rely on CLR to target the processor. How does VB6 code get converted into 0s and 1s? What is in between a VB6 code and the processor? I tried searching online, but all the resources only seem to tell you how to write a vb6 program. None that explains how it works.

Long story short: .net : CLR :: VB6 : ?

developer747
  • 15,419
  • 26
  • 93
  • 147
  • Does vb6 code already get converted to executable code? Or is it run by an interpreter like basic? – Burkhard Feb 19 '13 at 20:04
  • @Burkhard: There are these com + components that were originally built using vb6. People who built it are long gone. No one seems to know much about this. I need to fix one of these com + components. I am trying to understand how it works. – developer747 Feb 19 '13 at 20:06

1 Answers1

4

How does VB6 code get converted into 0s and 1s?

The VB6 compiler compiles the code into 0s and 1s, then the linker links that into an executable.

What is in between a VB6 code and the processor?

One may say, nothing.
Or a virtual machine, if the code was compiled to PCode and not to native binary (an option in project settings).
Alternatively, one may say there is the VB6 runtime in between, but it's much less of a runtime than CLR.

There are these com+ components that were originally built using vb6. People who built it are long gone. No one seems to know much about this. I need to fix a com+ component.

Knowing whether or not VB is compiled to native code won't really help here. You will have to debug it anyway, and the debugging will look the same in any case.

Is it possible to debug a vb6 program using VS 2010?

No.
Alternatively, one may say yes, if you're willing to turn on unmanaged code debugging and debug the VB component in assembler (not that you'll be able to do much after you find the problem).

GSerg
  • 76,472
  • 17
  • 159
  • 346
  • I agree with you that I can debug it without knowing how it gets converted to native code. But I feel it helps if we understand what happens underneath the covers :) For example there are many asp.net web form developers who manage to get the job done without knowing how http works. But don't you feel they would make better developers if they understood http better? – developer747 Feb 19 '13 at 20:25
  • 1
    @developer747 They would, because [every abstraction is leaky](http://www.joelonsoftware.com/articles/LeakyAbstractions.html). (But they would then switch to asp.net mvc.) You are correct that same logic applies here, but it applies, IMO, to much lesser degree given how the language is designed and positioned. I would argue knowing insides of VB wouldn't really help you to debug the component, it's knowing COM+ that would. – GSerg Feb 19 '13 at 20:31
  • 1
    A reasonable answer. Additional remarks. VB6 [shared](http://msdn.microsoft.com/en-us/library/aa263483(v=vs.60).aspx) the same compiler and linker as Visual C++, if you target native code. You can [debug VB6 code in Visual Studio 2008](http://stackoverflow.com/a/1022019/15639), using the VB6 source not assembler. I expect the same works in VS 2010. Because it's possible, doesn't mean it's a good idea. – MarkJ Feb 20 '13 at 12:38