GNU Info

Info Node: (nasm.info)Section 4.10.2

(nasm.info)Section 4.10.2


Next: Chapter 5 Prev: Section 4.10.1 Up: Section 4.10
Enter node , (file) or (file)node

4.10.2. `%!'`<env>': Read an environment variable.
--------------------------------------------------

   The `%!<env>' directive makes it possible to read the value of an
environment variable at assembly time. This could, for example, be used
to store the contents of an environment variable into a string, which
could be used at some other point in your code.

   For example, suppose that you have an environment variable `FOO', and
you want the contents of `FOO' to be embedded in your program. You
could do that as follows:

     %define FOO    %!FOO
     %define quote   '
     
     tmpstr  db      quote FOO quote

   At the time of writing, this will generate an "unterminated string"
warning at the time of defining "quote", and it will add a space before
and after the string that is read in. I was unable to find a simple
workaround (although a workaround can be created using a multi-line
macro), so I believe that you will need to either learn how to create
more complex macros, or allow for the extra spaces if you make use of
this feature in that way.


automatically generated by info2www version 1.2.2.9