compile option vbaide

Discussion in 'AutoCAD' started by MP, Jan 4, 2005.

  1. MP

    MP Guest

    Hi all,
    am I missing something?
    I run the Debug|compile option from the menu in the vba ide and nothing
    happens (once all the errors are fixed :) )
    except that a bunch of menu options are greyed out.
    Is that really the only response if a "compile" occurs successfully?
    or is that "pseudo-compile" (since in my understanding vba can't compile)
    no message no nothing?
    Tia
    Mark
     
    MP, Jan 4, 2005
    #1
  2. MP

    Ed Jobe Guest

    Mark
    In this case, no news is good news. :)
    VBA can compile, just not to exe or dll. It compiles to dvb. Hitting the
    save button doesn't perform a compile. If you have the option
    "Compile on demand" checked, you have to do this manually before you save
    and exit. Otherwise, the code is compiled each time you run the project in
    the IDE.
     
    Ed Jobe, Jan 4, 2005
    #2
  3. Hi,

    Adding to Ed advice that no news is good news.

    After compiling if you save the file in general the file size will be
    increased significantly.

    Try this:
    Open a DVB file.
    Save it from the VBAIDE
    From the VBAMAN use Save As and save under another name - note the file size
    Use the Debug compile
    Save it from the VBAIDE
    From the VBAMAN use Save As and save under yet another name
    From the VBAMAN Unload the file
    From the VBAMAN Reload the last file
    From the VBAMAN use Save As and save under yet another name
    Compare the file sizes.

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Jan 4, 2005
    #3
  4. MP

    MP Guest

    Yeah!
    Kinda like hearing from the IRS?
    :)
    Guess I just got used to the comforting progress bar in vb6 that at least
    lets you know somethings happening.
    I don't know what the difference between a "compiled" dvb is and an
    uncompiled one since they both are binary gibberish when looked at in
    notepad.
    Any way that just goes to show how badly I've neglected the practice of
    compiling before saving that it took till now to notice the lack of
    reportage.
    Thanks for the confirmation.
    Mark
     
    MP, Jan 5, 2005
    #4
  5. Hi,

    Yours is a fairly small simple file, but even so you can see effects of file
    size with the Debug Process. We have one program which flips around between
    7Mb and 12Mb.

    I still think it is worth while doing the "debug compile" as it will detect
    syntax errors in the code which are better detected by you than by your
    users.

    --

    Regards,


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Jan 5, 2005
    #5
  6. MP

    MP Guest

    ---> 27kb
    interesting that that doesn't change file date in explorer window!
    that does refresh the date

    - note the file size
    ---> 32kb
    second time it does refresh the date!
    ---> 48kb
    ---> 32kb
    ---> 32kb
    things that make you go hmmm.....

    :)
    Greets ta down under!
    Is it summer time down there?
    While I'm over here under 1" sheet of ice!
     
    MP, Jan 5, 2005
    #6
  7. MP

    Ed Jobe Guest

    Since you're familiar with vb, it should be easier to understand the
    difference. In vb, you compile to an exe or dll. You know that the "code"
    you are editing is just text, since you can open the bas file in Notepad and
    you can't "run" it. Compiling is the process of translating a higher level
    language into a lower one, one that the cpu can run. Granted the dvb is all
    "gibberish", but not because its compiled. Its because its in binary format.
    Part of it stores the text portion and part of it stores the compiled
    portion. Its possible, that at first it may not contain any compiled code.
    When you Debug>Compile, the compiled portion gets added. So a dvb is
    comparable to adding an exe, prj, bas, cls, and an frm all together, all the
    project files and the executable. That's why the project browser looks the
    same in vba as it does in vb, just that vb has to read the info from
    separate files.

    Laurie gave the example of 7mb growing to 12mb, a difference of 5mb. The
    compiled version is usually less than the non-compiled because it takes more
    memory to represent an instruction in human-readable form, e.g. one-two
    bytes for an instruction vs. many bytes for several characters.
     
    Ed Jobe, Jan 5, 2005
    #7
  8. MP

    MP Guest

    Thanks for the info.
    Yes that is understandable.

    that's what I would have expected as well (compiled < uncompiled), though I
    wasn't sure why I expected that. Your explanation makes perfect sense.
    However as his test shows it's the other way around. (at least in the small
    test i did)
    go figure.
     
    MP, Jan 5, 2005
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.