NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: iVision on July 24, 2013, 04:56:42 PM

Title: How to set include folders
Post by: iVision on July 24, 2013, 04:56:42 PM
Hello, sorry ignore the previous text that was here :P
How do I set an include path for nasm? And (to me its a bug) why does the cmd prompt needs to be in that folder, otherwise include doesn't work:

Files:
path\Server\socket.asm
path\Server\main.asm

Code: [Select]
path> nasm -f win32 Server\main.asmIt will fail that it cannot find %include "socket.asm"

But the main thing, how to set a include path?

Regards

Title: Re: warning initialize memory in .bss
Post by: Rob Neff on July 24, 2013, 05:11:37 PM
Try this ( note the squared brackets around the section ):

Code: [Select]
[section .bss]
emptyArray: resb 10
Title: Re: warning initialize memory in .bss
Post by: iVision on July 24, 2013, 05:24:10 PM
Just noticed its my bad, compiled the wrong file.. Anyway I have another problem, so Ill edit the main thread..
Title: Re: warning initialize memory in .bss
Post by: Frank Kotler on July 24, 2013, 05:25:59 PM
My understanding of the difference between "[section .bss]" and "section .bss" is that the latter is a macro which besides producing "[section .bss]" sets the "__SECT__" macro. It "shouldn't" make any difference besides that. I'd be looking at what comes after the code you posted. Do you switch to some section that allows initialized data before trying to initialize data (or code)? What you show looks "right" to me, so I suspect the problem is in something you don't show...

Best,
Frank

Title: Re: How to set include folders
Post by: Frank Kotler on July 24, 2013, 05:45:55 PM
Heh! Okay, ignore previous answers.

Code: [Select]
path> nasm -f win32 Server\main.asm -i Server\
(note that the trailing backslash is mandatory!)

In its zeal to be "OS-agnostic", Nasm doesn't do very well in following you around from directory to directory. The easiest thing may be to specify the complete path to the include file...
Code: [Select]
%include "C:\path\Server\socket.asm"
... or whatever is appropriate.

Best,
Frank

Title: Re: How to set include folders
Post by: iVision on July 24, 2013, 06:46:47 PM
Heh! Okay, ignore previous answers.

Code: [Select]
path> nasm -f win32 Server\main.asm -i Server\
(note that the trailing backslash is mandatory!)

In its zeal to be "OS-agnostic", Nasm doesn't do very well in following you around from directory to directory. The easiest thing may be to specify the complete path to the include file...
Code: [Select]
%include "C:\path\Server\socket.asm"
... or whatever is appropriate.

Best,
Frank

Okay too bad, is it possible to set includes? I mean I haven't find any settings file, why isn't it there? It would be nice if you could add C:\nasm\inc so that you can use %include "somefile.inc" instead of %include "C:\nasm\inc\somefile.inc"

Would be a really nice feature!  But I guess I have to stick with full paths or nasm -i flag
Regards
Title: Re: How to set include folders
Post by: Rob Neff on July 24, 2013, 07:43:33 PM
set NASMENV=-IC:\nasm\inc\

Title: Re: How to set include folders
Post by: Frank Kotler on July 24, 2013, 08:11:01 PM
As Rob says, NASMENV is probably your best bet. Nasm does not (and probably never will) depend on any external file for its functioning.

Best,
Frank