www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - windows wininet library

reply ketmar <ketmar ketmar.no-ip.org> writes:
how can i use wininet.dll from D? i got bindings from https://github.com/
CS-svnmirror/dsource-bindings-win32.git, and then i tried to create=20
wininet.lib with implib.exe from DMC package. no matter how i tried, the=20
resulting "wininet.lib" seems to not work, as linker keep complaining=20
about missing symbols like "_InternetReadFile 16" and so on.

i'm building for win32.

ah, and yep, i compiled "wininet.lib" to "lib" dir, and added option to=20
dmd.exe: "-L+wininet.lib".

i assume that i have to create corrent .def file to remap all the names,=20
am i right? oh, delightful...=
Jan 31 2015
next sibling parent reply "Jeremy DeHaan" <Dehaan.jeremiah gmail.com> writes:
On Sunday, 1 February 2015 at 07:32:05 UTC, ketmar wrote:
 how can i use wininet.dll from D? i got bindings from 
 https://github.com/
 CS-svnmirror/dsource-bindings-win32.git, and then i tried to 
 create
 wininet.lib with implib.exe from DMC package. no matter how i 
 tried, the
 resulting "wininet.lib" seems to not work, as linker keep 
 complaining
 about missing symbols like "_InternetReadFile 16" and so on.

 i'm building for win32.

 ah, and yep, i compiled "wininet.lib" to "lib" dir, and added 
 option to
 dmd.exe: "-L+wininet.lib".

 i assume that i have to create corrent .def file to remap all 
 the names,
 am i right? oh, delightful...
What does your implib command look like?
Feb 01 2015
parent ketmar <ketmar ketmar.no-ip.org> writes:
On Sun, 01 Feb 2015 08:10:30 +0000, Jeremy DeHaan wrote:

 On Sunday, 1 February 2015 at 07:32:05 UTC, ketmar wrote:
 how can i use wininet.dll from D? i got bindings from
 https://github.com/
 CS-svnmirror/dsource-bindings-win32.git, and then i tried to create
 wininet.lib with implib.exe from DMC package. no matter how i tried,
 the resulting "wininet.lib" seems to not work, as linker keep
 complaining about missing symbols like "_InternetReadFile 16" and so
 on.

 i'm building for win32.

 ah, and yep, i compiled "wininet.lib" to "lib" dir, and added option to
 dmd.exe: "-L+wininet.lib".

 i assume that i have to create corrent .def file to remap all the
 names,
 am i right? oh, delightful...
=20 What does your implib command look like?
i tried all possible variants -- both "/noi" and "/s", one of them and=20 nothing at all. neither of variants works. the thing is `extern(Windows)` ignores even `pragma(mangle)`, and=20 insisting on names like "_InternetReadFile 16". note the " 16" here --=20 this is the total size of arguments to `InternetReadFile()`. "wininet.dll"=20 has names without that sizes, so -- no luck. "implib" can't determine the=20 sizes by itself too. so there seems to be no way to create correct=20 library without manually writing ".def" file for it. p.s. i don't know why `extern(Windows)` ignores `pragma(mangle)`.=
Feb 01 2015
prev sibling parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Sun, 01 Feb 2015 07:32:05 +0000, ketmar wrote:

 how can i use wininet.dll from D? i got bindings from
 https://github.com/
 CS-svnmirror/dsource-bindings-win32.git, and then i tried to create
 wininet.lib with implib.exe from DMC package. no matter how i tried, the
 resulting "wininet.lib" seems to not work, as linker keep complaining
 about missing symbols like "_InternetReadFile 16" and so on.
=20
 i'm building for win32.
=20
 ah, and yep, i compiled "wininet.lib" to "lib" dir, and added option to
 dmd.exe: "-L+wininet.lib".
=20
 i assume that i have to create corrent .def file to remap all the names,
 am i right? oh, delightful...
so far i solved the problem by using this manually created "wininet.def"=20 file: LIBRARY wininet EXPORTS _InternetReadFile 16=3DInternetReadFile _InternetCloseHandle 4=3DInternetCloseHandle _HttpQueryInfoA 20=3DHttpQueryInfoA _HttpSendRequestA 20=3DHttpSendRequestA _HttpOpenRequestA 32=3DHttpOpenRequestA _InternetConnectA 32=3DInternetConnectA _InternetCrackUrlA 16=3DInternetCrackUrlA _InternetOpenA 20=3DInternetOpenA seems that my idea of using D to write a simple windows utility was very=20 wrong. ok, another attempt to use D for our windows developement has=20 failed. i'm in no way can sell manual ".def" creation to our team -- they=20 will make fun of me, showing how their Visual C can compile this code=20 without any troubles and external utilities...=
Feb 01 2015
next sibling parent reply "John Chapman" <johnch_atms hotmail.com> writes:
On Sunday, 1 February 2015 at 08:37:23 UTC, ketmar wrote:
 seems that my idea of using D to write a simple windows utility 
 was very
 wrong. ok, another attempt to use D for our windows 
 developement has
 failed. i'm in no way can sell manual ".def" creation to our 
 team -- they
 will make fun of me, showing how their Visual C can compile 
 this code
 without any troubles and external utilities...
It's easier to run coffimplib on the lib files from the Windows SDK.
Feb 01 2015
next sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
On Sun, 01 Feb 2015 16:07:58 +0000, John Chapman wrote:

 On Sunday, 1 February 2015 at 08:37:23 UTC, ketmar wrote:
 seems that my idea of using D to write a simple windows utility was
 very wrong. ok, another attempt to use D for our windows developement
 has failed. i'm in no way can sell manual ".def" creation to our team
 -- they will make fun of me, showing how their Visual C can compile
 this code without any troubles and external utilities...
=20 It's easier to run coffimplib on the lib files from the Windows SDK.
and what if i don't have that "windows sdk" thing, neither i know about=20 "coffimplib"? actually, i really don't have that sdk, 'cause new visual=20 studio doesn't want to be installed on my xp box, and i gave up searching=20 for old visual studio on ms site (and huh, they are HUGE!).=
Feb 01 2015
prev sibling parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Sun, 01 Feb 2015 16:07:58 +0000, John Chapman wrote:

 On Sunday, 1 February 2015 at 08:37:23 UTC, ketmar wrote:
 seems that my idea of using D to write a simple windows utility was
 very wrong. ok, another attempt to use D for our windows developement
 has failed. i'm in no way can sell manual ".def" creation to our team
 -- they will make fun of me, showing how their Visual C can compile
 this code without any troubles and external utilities...
=20 It's easier to run coffimplib on the lib files from the Windows SDK.
sorry if i'm rude, i really appreciate your advice. i messed myself=20 thinking that this is another thread in "general" NG.=
Feb 01 2015
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
Am 01.02.2015 um 17:15 schrieb ketmar:
 On Sun, 01 Feb 2015 16:07:58 +0000, John Chapman wrote:

 On Sunday, 1 February 2015 at 08:37:23 UTC, ketmar wrote:
 seems that my idea of using D to write a simple windows utility was
 very wrong. ok, another attempt to use D for our windows developement
 has failed. i'm in no way can sell manual ".def" creation to our team
 -- they will make fun of me, showing how their Visual C can compile
 this code without any troubles and external utilities...
It's easier to run coffimplib on the lib files from the Windows SDK.
sorry if i'm rude, i really appreciate your advice. i messed myself thinking that this is another thread in "general" NG.
The Windows SDK can be downloaded seperately from visual studio: https://msdn.microsoft.com/en-us/windows/desktop/ff851942.aspx They are also backwards compatible, so the latest one should work on XP. But you can also just use the oldest one available to make sure it still works on your machine.
Feb 01 2015
parent ketmar <ketmar ketmar.no-ip.org> writes:
On Sun, 01 Feb 2015 17:54:50 +0100, Benjamin Thaut wrote:

 Am 01.02.2015 um 17:15 schrieb ketmar:
 On Sun, 01 Feb 2015 16:07:58 +0000, John Chapman wrote:

 On Sunday, 1 February 2015 at 08:37:23 UTC, ketmar wrote:
 seems that my idea of using D to write a simple windows utility was
 very wrong. ok, another attempt to use D for our windows developement
 has failed. i'm in no way can sell manual ".def" creation to our team
 -- they will make fun of me, showing how their Visual C can compile
 this code without any troubles and external utilities...
It's easier to run coffimplib on the lib files from the Windows SDK.
sorry if i'm rude, i really appreciate your advice. i messed myself thinking that this is another thread in "general" NG.
The Windows SDK can be downloaded seperately from visual studio: https://msdn.microsoft.com/en-us/windows/desktop/ff851942.aspx =20 They are also backwards compatible, so the latest one should work on XP. But you can also just use the oldest one available to make sure it still works on your machine.
thank you. maybe this should be documented somehow -- page in Wiki,=20 perhaps, so people trying to find various import libraries can be pointed=20 there?=
Feb 01 2015
prev sibling parent "Kagamin" <spam here.lot> writes:
http://sourceforge.net/p/mingw/mingw-org-wsl/ci/master/tree/l
b/lib32/wininet.def 
?
Feb 02 2015