Is this a known bug of ml.exe? I.e. inconsistent treatment of spaces in filenames for include resp. includelib?
include \masm32\include\masm32rt.inc
; include "A simple dll.inc" ; no chance, doesn't work
; includelib A simple dll.lib ; tries to include A.lib and fails bitterly
include simple.inc ; works fine, but requires of course renaming of ""A simple dll.inc" to "simple.inc"
includelib "A simple dll.lib" ; works fine
.data
MyText db "This is a simple text, change it if you like", 0
AppName db "Test app:", 0
.code
start: invoke TellMe, NULL, addr MyText, addr AppName, MB_OK
exit
end start
The "library" is attached.
[attachment deleted by admin]
JJ,
I think the "include" and "includelib" operators were designed about 1990 so I doubt they natively support long file names with spaces. It may have changed on a lated ML version but I have not tested it.
This works, right?
include A simple dll.inc
includelib "A simple dll.lib"
I have no idea why quotes are required in one case but not the other, but it may have something to do with the includelib statement just passing the name to the linker, or it may be just because the two instructions have no relation to each other, we just happen to often use them consecutively.
Hi,
in Masm, if a filename contains spaces, it has to be but in angle brackets, not in double quotes:
include <a filename with spaces.inc>
Quote from: japheth on July 07, 2008, 05:39:43 AM
Hi,
in Masm, if a filename contains spaces, it has to be but in angle brackets, not in double quotes:
include <a filename with spaces.inc>
Did you test that?
include <A simple lib.inc>
includelib <A simple lib.lib>
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
LINK : fatal error LNK1104: cannot open file "
A.lib"
Quote from: jj2007 on July 07, 2008, 07:24:17 AM
Did you test that?
Of course :toothy ... but I was using MS link 6.00.8168 (1998, MS VC 6).
Ho Hum etc .....
[attachment deleted by admin]
; call DoNothing
Remove the ; and run makeit...
include <long file name.inc> works,
includelib <A simple lib.lib> does not work.
As to versions, I have unfortunately only access to the default Masm32 linker. It is not a big issue anyway - nobody needs spaces in filenames ;-)
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
LINK : fatal error LNK1104: cannot open file "A.lib"
[attachment deleted by admin]
include long file name.inc
include A simple lib.inc
includelib "A simple lib.lib"
Microsoft (R) Macro Assembler Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
Assembling: long file name.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Volume in drive F is Programming
Volume Serial Number is 30A7-BC1C
Directory of F:\WinAsm\Progs\alltemps\long dir name
07/07/2008 06:58 AM 700 long file name.asm
07/07/2008 07:00 AM 2,560 long file name.exe
07/07/2008 08:29 PM 196 long file name.inc
07/07/2008 07:00 AM 1,153 long file name.obj
4 File(s) 4,609 bytes
0 Dir(s) 19,509,743,616 bytes free
Press any key to continue . . .
Works for me.
As a result of testing, I definitely agree with Jimq. As far as the reasoning for the disparity, I work it out in 'my' mind in this way. INCLUDE has been supported since masm 5.0 whereas INCLUDELIB came along much later when file systems became more sophisticated. The reason why INCLUDE was never upgraded? Who knows, but my experience with MS has always told me they are very slow to change. As far as a need goes, if you think it is necessary to use long filenames for legibility sake use an alias in the program by means of an equate.
-- Paul
Quote from: jj2007 on July 07, 2008, 10:56:21 AM
; call DoNothing
Remove the ; and run makeit...
Quote from: Jimg on July 07, 2008, 02:01:27 PM
Works for me.
Did you enable the
call DoNothing? The linker chokes only when I actually use the lib - the
call DoNothing contains a reference to the lib, the
fn MessageBox,0,"Include file with a long file name with spaces","Howdy",MB_OK
doesn't. Anyway, I am not a fan of long file names, let alone spaces in them. Back to DOS 8.3 ;-) !!
Yes, the second messagebox works without a problem, it prints out this box does nothing.
I also tried moving to a long file name-
Include R:\This is a long screwed...up folder\a b c d e f\A simple lib.inc
includelib "R:\This is a long screwed...up folder\a b c d e f\A simple lib.lib"
and it still works without a problem.
I still think that INCLUDE is for Masm's own use, and it knows everything it needs to to find the file and doesn't need no 'steenking' quotes, where INCLUDELIB is just passed along to link so it wants it specified and delimited exactly.
I got it, finally: All this works...
include <long file name.inc>
include A simple lib.inc
includelib "A simple lib.lib"
... but ml doesn't like "these quotes", while link doesn't like <these quotes>
tmp_file.asm(4) : fatal error A1000: cannot open file : "A simple lib.inc"
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
LINK : fatal error LNK1104: cannot open file "A.lib"
Hey all,
The problems people are having with Include and IncludeLib are "two" different problems.
One is handle by ML.EXE (the include) which all includes are on a line by its own. So you can wrap it in <> which is C / C++ style including (which ML.EXE was also used when compiling an application. And if you dont', ML.EXE will still assume whatever is after the include up until the /r/n is all part of the filename.
The IncludeLib is as most people say, past directly to the linker. Take this example:
link /LIB:r:\this is a directory; \this is another directory
When Link.exe tries to run, because the way it parses the line (by looking for spaces, then keywords (like /LIB), then the parameters for the keyword (like r:\this is a directory), to make sure the full parameter gets resolved, you need to put it in Quotes "\r:this is a directory". That way, it becomes a single directory parameter for /LIB instead of four paramters (\r:this.lib, is.lib a.lib directory.lib).
So the easiest way to remember, is if you put spaces in your filenames for INCLUDE, you can either just go about your business like you have, or wrap the filename in a <>.
For the INCLUDELIB, even non-space filenames, can accept Quotes around them so if you want to get into a habit, always put quotes around the library name. But if you DO use spaces in your filename, you MUST put quotes around it.
I'm not the best writer of text so I hope this is clear. :-)
Relvinian