Thread overview
windows wininet library
Feb 01, 2015
ketmar
Feb 01, 2015
Jeremy DeHaan
Feb 01, 2015
ketmar
Feb 01, 2015
ketmar
Feb 01, 2015
John Chapman
Feb 01, 2015
ketmar
Feb 01, 2015
ketmar
Feb 01, 2015
Benjamin Thaut
Feb 02, 2015
ketmar
Feb 02, 2015
Kagamin
February 01, 2015
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...

February 01, 2015
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?
February 01, 2015
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...
> 
> What does your implib command look like?

i tried all possible variants -- both "/noi" and "/s", one of them and nothing at all. neither of variants works.

the thing is `extern(Windows)` ignores even `pragma(mangle)`, and insisting on names like "_InternetReadFile@16". note the "@16" here -- this is the total size of arguments to `InternetReadFile()`. "wininet.dll" has names without that sizes, so -- no luck. "implib" can't determine the sizes by itself too. so there seems to be no way to create correct library without manually writing ".def" file for it.

p.s. i don't know why `extern(Windows)` ignores `pragma(mangle)`.

February 01, 2015
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.
> 
> 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...

so far i solved the problem by using this manually created "wininet.def" file:

  LIBRARY wininet
  EXPORTS
   _InternetReadFile@16=InternetReadFile
   _InternetCloseHandle@4=InternetCloseHandle
   _HttpQueryInfoA@20=HttpQueryInfoA
   _HttpSendRequestA@20=HttpSendRequestA
   _HttpOpenRequestA@32=HttpOpenRequestA
   _InternetConnectA@32=InternetConnectA
   _InternetCrackUrlA@16=InternetCrackUrlA
   _InternetOpenA@20=InternetOpenA

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...

February 01, 2015
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.
February 01, 2015
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.

and what if i don't have that "windows sdk" thing, neither i know about "coffimplib"? actually, i really don't have that sdk, 'cause new visual studio doesn't want to be installed on my xp box, and i gave up searching for old visual studio on ms site (and huh, they are HUGE!).

February 01, 2015
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.

February 01, 2015
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.
February 02, 2015
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
> 
> 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, perhaps, so people trying to find various import libraries can be pointed there?

February 02, 2015
http://sourceforge.net/p/mingw/mingw-org-wsl/ci/master/tree/lib/lib32/wininet.def ?