www.digitalmars.com         C & C++   DMDScript  

c++ - Error 42: Symbol Undefined _URLDownloadToCacheFileA 24

reply SL <shadowlord13 gmail.com> writes:
I'm getting this error in a program, on linking:
  Error 42: Symbol Undefined _URLDownloadToCacheFileA 24

The program #include's <urlmon.h>, and urlmon.lib is included in the 
compile line. I generated urlmon.lib from urlmon.dll with implib 
("Digital Mars Import Library Manager Version 7.5B4n").

Compile line:
	dmc.exe -oSyncStarmap.exe c:\dm\lib\urlmon.lib -D -g -DWINDOWS -DMULTI 
SyncSm.cpp genalg.cpp randalg.cpp SyncSm.def -mn -5 | more

Paths etc:
	set path=c:\dm\bin;c:\windows\system32;c:\windows;c:\windows\command
	set lib=c:\dm\lib
	set include=c:\dm\include

What I see when I attempt to compile it:
	Compiling SyncStarmap...
	SyncSm.cpp:
	genalg.cpp:
	randalg.cpp:
	link 
SyncSm+genalg+randalg,SyncStarmap.exe,,c:\dm\lib\urlmon+user32+kernel32,Syn
cSm/co/noi;
	OPTLINK (R) for Win32  Release 7.50B1
	Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

	SyncSm.obj(SyncSm)
	 Error 42: Symbol Undefined _URLDownloadToCacheFileA 24

	--- errorlevel 1

SyncSm.cpp is calling URLDownloadToCacheFile like so:
	int hresult = URLDownloadToCacheFile(NULL, 
"http://there-was-a-url-here-but-I've-removed-it", path, sizeof(path), 
0, &downloadCallback);

Since it's compiling right, it must be a problem with the lib, right? 
The function names inside the lib don't look mangled at all (It's just 
"URLDownloadToCacheFileA", so ... c:\dm\include\win32\urlmon.h has this 
definition for URLDownloadToCacheFileA: STDAPI 
URLDownloadToCacheFileA(LPUNKNOWN,LPCSTR,LPTSTR,DWORD,DWORD,LP
INDSTATUSCALLBACK); 


How can I make this work? What's wrong with it?

I've attempted remaking the lib:
Originally I had done just implib urlmon.lib urlmon.dll (I copied 
urlmon.dll into the c:\dm\bin folder, and after running implib, copied 
the generated urlmon.lib into c:\dm\lib)
The lib made by implib /system urlmon.lib urlmon.dll resulted in the 
same link-time error.
And this did too: implib /system /v /suffix urlmon.lib urlmon.dll
This one didn't work, I got a "Could not start SPPN.EXE!" error: implib 
/system /v /suffix /Ic:\dm\include\win32 urlmon.lib urlmon.dll
Mar 18 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"SL" <shadowlord13 gmail.com> wrote in message
news:d1f39h$1eor$1 digitaldaemon.com...
 I'm getting this error in a program, on linking:
   Error 42: Symbol Undefined _URLDownloadToCacheFileA 24

 The program #include's <urlmon.h>, and urlmon.lib is included in the
 compile line. I generated urlmon.lib from urlmon.dll with implib
 ("Digital Mars Import Library Manager Version 7.5B4n").
Examine the urlmon.lib to see if it defines the symbol. The lib.exe program can generate a listing of its table of contents.
Mar 18 2005
parent reply SL <shadowlord13 gmail.com> writes:
Walter wrote:
 "SL" <shadowlord13 gmail.com> wrote in message
 news:d1f39h$1eor$1 digitaldaemon.com...
 
I'm getting this error in a program, on linking:
  Error 42: Symbol Undefined _URLDownloadToCacheFileA 24

The program #include's <urlmon.h>, and urlmon.lib is included in the
compile line. I generated urlmon.lib from urlmon.dll with implib
("Digital Mars Import Library Manager Version 7.5B4n").
Examine the urlmon.lib to see if it defines the symbol. The lib.exe program can generate a listing of its table of contents.
Hmm. Here's the output of implib and then lib (I tried using lib /? to see how to use it, but it didn't like that): C:\dm\bin>implib /system /v /suffix urlmon.lib urlmon.dll Digital Mars Import Library Manager Version 7.5B4n Copyright (C) Digital Mars 1999-2002. All Rights Reserved. Modified by Jan Knepper urlmon.lib Input is a Windows NT DLL file 'urlmon.dll'. Output is a Windows NT import library. Digital Mars Import Library Creator complete. C:\dm\bin>lib /? Digital Mars Librarian Version 8.00n Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com Error: /?.lib : Invalid argument C:\dm\bin>lib Digital Mars Librarian Version 8.00n Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com library file (.lib) urlmon.lib action-object [-+*] (.obj) list file (.lst) urlmon.lst Error: Corrupt file 'urlmon.lib', Typ=xf1, Len=xcd1e Well that's weird. Guess I'd better try to find something about lib in the manual/readme/something.
Mar 18 2005
parent reply SL <shadowlord13 gmail.com> writes:
Ok, 'lib -l urlmon.lib' is erroring with 'Corrupt file 'urlmon.lib', 
Typ=xf1, Len=xcd1e'

Hmm. So implib didn't do its job right?

If I do 'implib urlmon.lib urlmon.dll', and then run 'lib -l urlmon.lib' 
I get the same error, ecept Len is xcd17 instead of xcd1e.
Mar 18 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"SL" <shadowlord13 gmail.com> wrote in message
news:d1fegt$23ic$1 digitaldaemon.com...
 Ok, 'lib -l urlmon.lib' is erroring with 'Corrupt file 'urlmon.lib',
 Typ=xf1, Len=xcd1e'

 Hmm. So implib didn't do its job right?
Or something else is happening. implib has been in the field for over a decade, it works fine.
 If I do 'implib urlmon.lib urlmon.dll', and then run 'lib -l urlmon.lib'
 I get the same error, ecept Len is xcd17 instead of xcd1e.
Mar 18 2005
parent reply SL <shadowlord13 gmail.com> writes:
 Or something else is happening. implib has been in the field for over a
 decade, it works fine.
I just redownloaded the "Basic Utilities Package" and tried the implib.exe in that (That implib.exe is version 7.6B1n, the old one I had was 7.5B4n). It actually appears to have made a library which doesn't confuse lib.exe. However, the .lib doesn't contain the NN, so I'm still getting the "Symbol Undefined _URLDownloadToCacheFileA 24" error. Hmm.
Mar 18 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"SL" <shadowlord13 gmail.com> wrote in message
news:d1frg2$2hl9$1 digitaldaemon.com...
 Or something else is happening. implib has been in the field for over a
 decade, it works fine.
I just redownloaded the "Basic Utilities Package" and tried the implib.exe in that (That implib.exe is version 7.6B1n, the old one I had was 7.5B4n). It actually appears to have made a library which doesn't confuse lib.exe. However, the .lib doesn't contain the NN, so I'm still getting the "Symbol Undefined _URLDownloadToCacheFileA 24" error.
Now we're getting somewhere. Check out www.digitalmars.com/faq.html#sysimport
Mar 18 2005
parent reply SL <shadowlord13 gmail.com> writes:
Walter wrote:
 Now we're getting somewhere. Check out
 www.digitalmars.com/faq.html#sysimport
 
 
Ah! Thanks. I thought I might have to do something like that, but was Hmm - I should perhaps be able to (in theory) make a script to look apparently the number of bytes its parameters are. That'd be more trouble than its worth for just the one function I need now, but might be useful in the future, and for other people. Hmm. (P.S. I noticed that Microsoft's link.exe no longer has a /convert option (at least in the link.exe in "Microsoft Visual C++ Toolkit 2003", which is supposed to be the same as the one in VS.NET 2003) - I'm mentioning this because http://www.digitalmars.com/ctg/coff2omf.html suggests running link /lib /convert file.lib to make the lib usable by coff2omf))
Mar 18 2005
parent Scott Michel <scottm aero.org> writes:
SL wrote:
  > (P.S. I noticed that Microsoft's link.exe no longer has a /convert
 option (at least in the link.exe in "Microsoft Visual C++ Toolkit 2003", 
 which is supposed to be the same as the one in VS.NET 2003) - I'm 
 mentioning this because http://www.digitalmars.com/ctg/coff2omf.html 
 suggests running link /lib /convert file.lib to make the lib usable by 
 coff2omf))
It's not hard to find slightly older versions of LINK that still support the /convert flag. Google for MASM. The current MASM package has a LINK that works.
Mar 24 2005