Home > Archive > Cobol > October 2005 > IMPLIB and LNK1136
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
IMPLIB and LNK1136
|
|
| jlcaverlyca@yahoo.ca 2005-10-26, 6:55 pm |
| Hi,
I am using Micro Focus Visual Object COBOL V1.0, on Windows 98SE.
I have the following code;
$set SourceFormat"Free" case
special-names.
call-convention 74 is WINAPI.
procedure division.
CALL "COB32API".
DISPLAY "Downloading File".
CALL WINAPI "URLDownloadToFile" USING
BY VALUE 0
BY REFERENCE "http://www.microsoft.com/index.html"
BY REFERENCE "index.htm"
BY VALUE 0
BY VALUE 0
END-CALL.
DISPLAY "Download Complete".
stop run.
URLDownloadToFile is contained in URLMON.DLL, which is in the
\WINDOWS\SYSTEM directory.
There is no URLMON.LIB file included with VOC, so I have to create one
using IMPLIB.EXE. I note that IMPLIB.EXE does not come with VOC. So, I
am using IMPLIB.EXE that comes with Borland C++ 5.5.
I use the command line;
implib urlmon.lib c:\windows\system\urlmon.dll
to create URLMON.LIB, and it is created, with no errors.
When I link it into my COBOL program, I get the following error;
C:\VisOC\LIB\URLMON.LIB: fatal error LNK1136: invalid or corrupt file
Here are the options for IMPLIB.EXE
Borland Implib Version 3.0.22 Copyright (c) 1991, 2000 Inprise
Corporation
Syntax: IMPLIB [options] libname[.lib] [@respfile | srcname] [srcname
....]
Options:
-a Add '_' alias for MS flavor cdecl functions
-c Case sensitive symbols
-f Force imports by name (with hints)
-w No Warnings
I have tried the -a option, same result.
I have tried the -c option, same result.
I have tried the -f option, same result.
I have tried no options, same result.
The URLMON.LIB file is being created in the C:\VisOC\LIB directory.
I welcome any constructive suggestions on how to create the .LIB file
correctly so that I can link it into my COBOL program.
Thanks,
Joe
| |
| Richard 2005-10-26, 6:55 pm |
|
> CALL WINAPI "URLDownloadToFile" USING
> BY VALUE 0
BY REFERENCE "http://www.microsoft.com/index.html" & x"00"
BY REFERENCE "index.htm" & x"00"
> BY VALUE 0
> BY VALUE 0
> Borland Implib Version 3.0.22
Borland libraries and MS do not mix. The Cobol is MS based and so
probably won't like the Borland .LIB.
| |
| James J. Gavan 2005-10-26, 6:55 pm |
| jlcaverlyca@yahoo.ca wrote:
> Hi,
> I am using Micro Focus Visual Object COBOL V1.0, on Windows 98SE.
It's a real tough furrow to plough with VISOC - since then we've gone up
to Net Express V 3.1, V 4., (about two years old ?) and sometime next
Spring, V 5.0
Pure long-shot - try this link on APIs :-
http://www.kimsoft.com/api-COBOL/api-COBOL.htm
There might be something in one of Young's chapters that *might* help;
even though he was writing for N/E V 3.1, chances are any 'features'
will be acceptable for VISOC.
Other possibilities, go to Micro Focus home page and using 'self help'
to check out their Knowledge Base using 'DLL' for your search. Perhaps
not likely but if you access their examples, just might be something there.
One other thing I recall being mentioned here (c.l.c.), in the Spring,
was software to 'unpack' a DLL to get at features. Can somebody else
fill in on that ?
Yet another; you have the MS SDK on CD so you could load that and
perhaps link into MSDN and their Knowledge Base.
Assuming you have a legit purchased copy of VISOC, (not the Beta), then
perhaps you could join the Micro Focus Forum and post your query under
heading "Other Micro Focus Products". If Simon Tobias or Stephen Gennard
are lurking there in the background, perhaps they could confirm if this
is an option, for you ?
Jimmy, Calgary AB
| |
| jlcaverlyca@yahoo.ca 2005-10-26, 6:55 pm |
| Hi,
Thanks for the reply.
I have, according to the Visual Object COBOL Help dialog, File
Version 0.0.3.0, Product Version 1.0.27, Built: Apr 22 1996 13:29:48
Joe
James J. Gavan wrote:
> jlcaverlyca@yahoo.ca wrote:
>
> It's a real tough furrow to plough with VISOC - since then we've gone up
> to Net Express V 3.1, V 4., (about two years old ?) and sometime next
> Spring, V 5.0
>
> Pure long-shot - try this link on APIs :-
>
> http://www.kimsoft.com/api-COBOL/api-COBOL.htm
>
> There might be something in one of Young's chapters that *might* help;
> even though he was writing for N/E V 3.1, chances are any 'features'
> will be acceptable for VISOC.
>
> Other possibilities, go to Micro Focus home page and using 'self help'
> to check out their Knowledge Base using 'DLL' for your search. Perhaps
> not likely but if you access their examples, just might be something there.
>
> One other thing I recall being mentioned here (c.l.c.), in the Spring,
> was software to 'unpack' a DLL to get at features. Can somebody else
> fill in on that ?
>
> Yet another; you have the MS SDK on CD so you could load that and
> perhaps link into MSDN and their Knowledge Base.
>
> Assuming you have a legit purchased copy of VISOC, (not the Beta), then
> perhaps you could join the Micro Focus Forum and post your query under
> heading "Other Micro Focus Products". If Simon Tobias or Stephen Gennard
> are lurking there in the background, perhaps they could confirm if this
> is an option, for you ?
>
> Jimmy, Calgary AB
| |
|
| Hello Joe,
You do not have to use a .lib, you could use the dynamic call-convention
(66 instead of 74) and then preload urlmon.dll.
Note, a couple of other changes...
- you need to use URLDownloadToFileA instead of URLDownloadToFile (ASCII
version of the API)
- and zero terminate your strings
- changed "by value 0" to "by reference omitted" (personal preference)
- check return-code
For example:
$set SourceFormat"Free" case
special-names.
call-convention 66 is WINAPI.
working-storage section.
01 load-ptr procedure-pointer.
01 bad-ptr procedure-pointer.
procedure division.
set bad-ptr to entry "abcdefgh"
set load-ptr to entry "urlmon"
if bad-ptr equals load-ptr
stop "Sorry unable to load urlmon.dll"
stop run
end-if
DISPLAY "Downloading File".
CALL WINAPI "URLDownloadToFileA" USING
BY REFERENCE OMITTED
BY REFERENCE z"http://www.microsoft.com"
BY REFERENCE z"index.htm"
BY VALUE 0 SIZE 4
BY REFERENCE OMITTED
END-CALL
DISPLAY "Download Complete? - " return-code
stop run
--
Stephen
> Hi,
> I am using Micro Focus Visual Object COBOL V1.0, on Windows 98SE.
> I have the following code;
>
> $set SourceFormat"Free" case
> special-names.
> call-convention 74 is WINAPI.
> procedure division.
> CALL "COB32API".
> DISPLAY "Downloading File".
> CALL WINAPI "URLDownloadToFile" USING
> BY VALUE 0
> BY REFERENCE "http://www.microsoft.com/index.html"
> BY REFERENCE "index.htm"
> BY VALUE 0
> BY VALUE 0
> END-CALL.
> DISPLAY "Download Complete".
> stop run.
> URLDownloadToFile is contained in URLMON.DLL, which is in the
> \WINDOWS\SYSTEM directory.
>
> There is no URLMON.LIB file included with VOC, so I have to create one
> using IMPLIB.EXE. I note that IMPLIB.EXE does not come with VOC. So, I
> am using IMPLIB.EXE that comes with Borland C++ 5.5.
>
> I use the command line;
>
> implib urlmon.lib c:\windows\system\urlmon.dll
>
> to create URLMON.LIB, and it is created, with no errors.
>
> When I link it into my COBOL program, I get the following error;
>
> C:\VisOC\LIB\URLMON.LIB: fatal error LNK1136: invalid or corrupt file
>
> Here are the options for IMPLIB.EXE
>
> Borland Implib Version 3.0.22 Copyright (c) 1991, 2000 Inprise
> Corporation
>
> Syntax: IMPLIB [options] libname[.lib] [@respfile | srcname] [srcname
> ...]
> Options:
> -a Add '_' alias for MS flavor cdecl functions
> -c Case sensitive symbols
> -f Force imports by name (with hints)
> -w No Warnings
> I have tried the -a option, same result.
> I have tried the -c option, same result.
> I have tried the -f option, same result.
> I have tried no options, same result.
> The URLMON.LIB file is being created in the C:\VisOC\LIB directory.
>
> I welcome any constructive suggestions on how to create the .LIB file
> correctly so that I can link it into my COBOL program.
>
> Thanks,
>
> Joe
>
| |
| Michael Wojcik 2005-10-26, 6:55 pm |
|
In article <1130339011.555914.315190@z14g2000cwz.googlegroups.com>, "jlcaverlyca@yahoo.ca" <jlcaverlyca@yahoo.ca> writes:
>
> I am using Micro Focus Visual Object COBOL V1.0, on Windows 98SE.
Ouch. I believe you're in Unsupported Product territory with both
of those.
> URLDownloadToFile is contained in URLMON.DLL, which is in the
> \WINDOWS\SYSTEM directory.
>
> There is no URLMON.LIB file included with VOC, so I have to create one
> using IMPLIB.EXE. I note that IMPLIB.EXE does not come with VOC. So, I
> am using IMPLIB.EXE that comes with Borland C++ 5.5.
>
> When I link it into my COBOL program, I get the following error;
>
> C:\VisOC\LIB\URLMON.LIB: fatal error LNK1136: invalid or corrupt file
You could try using a different version of link.exe (does Borland
C++ 5.5 ship with one?). It's possible that the link.exe included
with VOC is too old.
What you really need, though, are implib and link from the Microsoft
Platform SDK for Windows 98SE, and that could be a problem, because
I don't believe Microsoft is still distributing it.
--
Michael Wojcik michael.wojcik@microfocus.com
Advertising Copy in a Second Language Dept.:
The precious ovum itself is proof of the oath sworn to those who set
eyes upon Mokona: Your wishes will be granted if you are able to invest
it with eternal radiance... -- Noriyuki Zinguzi
| |
| jlcaverlyca@yahoo.ca 2005-10-26, 6:55 pm |
| spg wrote:
> Hello Joe,
>
> You do not have to use a .lib, you could use the dynamic call-convention
> (66 instead of 74) and then preload urlmon.dll.
Hi Stephen,
Thankyou for teaching me something new. It works perfectly.
I took a look at bit 3, which ensures that the call name is resolved
at link time rather than run time, which is set in the 74
call-convention, but not set in the 66 call-convention.
So, is this the COBOL way of doing LoadLibrary and GetProcAddress?
Thanks again,
Joe
| |
|
| Hello Joe,
Yes, it is the same as doing a LoadLibrary/GetProcAddress with the exception
that the Runtime does it for you and thus it is able to search inside it
for you too.
--
Stephen
> spg wrote:
>
> Hi Stephen,
> Thankyou for teaching me something new. It works perfectly.
> I took a look at bit 3, which ensures that the call name is resolved
> at link time rather than run time, which is set in the 74
> call-convention, but not set in the 66 call-convention.
>
> So, is this the COBOL way of doing LoadLibrary and GetProcAddress?
>
> Thanks again,
>
> Joe
>
|
|
|
|
|