News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Extern's really blowing my mind

Started by Robert Collins, February 28, 2005, 11:32:52 PM

Previous topic - Next topic

Robert Collins

I am writting a program using two modules. In Module A I use some functions that are defined in Module B. So, in Module A I declare all of those functions as 'extern' and I not only define the functions in Module B but I also include the proto for them as well. During the compile stage there is no problem but during link time I get unresolved external references on all of the functions. What else can/should I do? I don't get it :dazzled: 

Robert Collins

OK, never mind. I think I found the reason. The functions in Module B are declared as static and I guess that you can't define static functions as extern in Module A so I had to copy the functions using those static functions from Module A to Module B.

rea

You are using "C" or for what you say that your functions are declared as static?? (I dont get it)


Also watch the documentation of your assembler.


For example like I know extern is "Importing Symbols from Other Modules" mean that in the object file the assembler will put a flag in the name of the function or somewhere, indicating that the symbol is not defined in the actual object file and is needed to know where the symbol is.

And global or public is "Exporting Symbols to Other Modules" mean that in the object file the assembler will put a flag in the name of the function or somewhere, indicating that the symbol is defined in the current object file and that others modules that have a reference to the name can "know" where is the entry point.



By the way, a symbol  indicate a place in memory.