P-Code VS Native Code

Posted In Tutorials - By NitiN Kumar Jain On Friday, December 19th, 2008 With 0 Comments






Pin It


We can choose whether to compile our software as Native Code or P-Code (pseudocode). The default option is Native code and should be left like that.

What is P-Code?

When pressing the Start button in the Visual Basic IDE, the Visual Basic compiles each line into P-Code and interprets it. This is much faster than Native Code in the IDE circumstance. By choosing to compile your software into P-Code, Visual Basic will store that code into an EXE where it will be interpreted line by line for the rest of its life

What is Native Code?

Native Code came out with Visual Basic 6.0. Running Native code is much faster than running P-Code in an exe case. When compiling to Native Code, Visual Basic compiles your software into the instruction set of the processor chip on your system

1.      Using Friend Function with Implements Does Not Work in P-Code

2.      Order of Evaluation Change between Native Code and P- Code (Visual Basic does not guarantee the order of evaluation in expressions when programs are compiled to native code with optimizations)

3.      Visual Basic does not evaluate Byte data type correctly in the “IF” expression when compiled to Native code with optimizations.

4.      P-code applications are usually smaller (and slower) than native code.

-NKJ