News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

working with several source files

Started by xandaz, June 07, 2020, 05:15:43 AM

Previous topic - Next topic

xandaz

   hello guys and thanks in advance. I've been trying to make a program and am using several source files. It's being hard to understand where to place the include directive. I always get anunresolved external error. Do i need the externdef command?
Can someone provide me with a little insight.
   Thanks

daydreamer

well if you make code in a separate .inc file which I do much nowadays,you should include it below all the other masm32 includes and you might need to use PROTO 's above for PROC's you need to invoke
its hard to judge error without seeing any code
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

Splitting a source was common in the old times when editors and compilers were utterly slow. Nowadays it makes only sense when you have modules that you really use in different projects.

Having said that: "include" simply includes the text (same for macros btw). Try replacing the include line with the actual text, and then find out why you get such "undefined" errors. The assembler works strictly sequentially, i.e. you can use a symbol only if it was defined above.

hutch--

It has to do with the logic of how you lay out the source code for an application. Generally you have a main or starting file and a tree structure of include files branching from it. Small apps don't need much separation but make any reasonable sized app with multiple dialogs, wide ranging complex code and multiple windows and it becomes a nightmare to find your way around. This is why professional software is written in modules and if it is code that is not going to change, its often sensible to put it into a library module.

xandaz

    Thanks a lot. You've been helpful. I was also helped by the MDI example that comes with MASM32 SDK.
    Thanks a lot