The MASM Forum

General => The Campus => Topic started by: xandaz on June 07, 2020, 05:15:43 AM

Title: working with several source files
Post by: xandaz on June 07, 2020, 05:15:43 AM
   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
Title: Re: working with several source files
Post by: daydreamer on June 07, 2020, 06:20:08 AM
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
Title: Re: working with several source files
Post by: jj2007 on June 07, 2020, 08:17:51 AM
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.
Title: Re: working with several source files
Post by: hutch-- on June 07, 2020, 09:56:12 AM
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.
Title: Re: working with several source files
Post by: xandaz on June 14, 2020, 10:10:19 AM
    Thanks a lot. You've been helpful. I was also helped by the MDI example that comes with MASM32 SDK.
    Thanks a lot