www.digitalmars.com         C & C++   DMDScript  

D - Winsock interface...

reply Evan McClanahan <evan dontSPAMaltarinteractive.com> writes:
I'm working at the first pass of a winsock interface, something that 
could work as a back end for a platform independant sockets lib that I 
hope to write.  However, I'm having some trouble getting the thing to 
interface correctly with the winsock.dll file.   There's no winsock.lib, 
so I don't really know how to get it to link correctly.  I'm scanning 
the docs, but haven't found anything so far.  Anyone know how to do 
this(module definition files, maybe?)?

Evan
Nov 07 2002
parent reply Burton Radons <loth users.sourceforge.net> writes:
Evan McClanahan wrote:
 I'm working at the first pass of a winsock interface, something that 
 could work as a back end for a platform independant sockets lib that I 
 hope to write.  However, I'm having some trouble getting the thing to 
 interface correctly with the winsock.dll file.   There's no winsock.lib, 
 so I don't really know how to get it to link correctly.  I'm scanning 
 the docs, but haven't found anything so far.  Anyone know how to do 
 this(module definition files, maybe?)?
Yup. I create lib files using "implib opengl32.lib opengl32.def", where implib is from the utilities package (ftp://ftp.digitalmars.com/Digital_Mars_C++/Patch/dm812util.zip). If you're lucky, you can produce a library directly from the DLL. If you're not, the form for such a .def file is: LIBRARY <dll filename> EXPORTS <real symbol that D would produce>=<stupid symbol that is in the DLL> ...
Nov 07 2002
next sibling parent Evan McClanahan <evan dontSPAMaltarinteractive.com> writes:
Burton Radons wrote:
 Evan McClanahan wrote:
 
 I'm working at the first pass of a winsock interface, something that 
 could work as a back end for a platform independant sockets lib that I 
 hope to write.  However, I'm having some trouble getting the thing to 
 interface correctly with the winsock.dll file.   There's no 
 winsock.lib, so I don't really know how to get it to link correctly.  
 I'm scanning the docs, but haven't found anything so far.  Anyone know 
 how to do this(module definition files, maybe?)?
Yup. I create lib files using "implib opengl32.lib opengl32.def", where implib is from the utilities package (ftp://ftp.digitalmars.com/Digital_Mars_C++/Patch/dm812util.zip). If you're lucky, you can produce a library directly from the DLL. If you're not, the form for such a .def file is: LIBRARY <dll filename> EXPORTS <real symbol that D would produce>=<stupid symbol that is in the DLL> ...
OK, thanks. Also, I'm in the course of DLing ACE, so maybe the foundations of that will point to a better way of making a sockets module. I have the feeling that ACE is just too damn large to port over in its entierty. Evan
Nov 07 2002
prev sibling parent reply Evan McClanahan <evan dontSPAMaltarinteractive.com> writes:
Burton Radons wrote:
 Evan McClanahan wrote:
 
 I'm working at the first pass of a winsock interface, something that 
 could work as a back end for a platform independant sockets lib that I 
 hope to write.  However, I'm having some trouble getting the thing to 
 interface correctly with the winsock.dll file.   There's no 
 winsock.lib, so I don't really know how to get it to link correctly.  
 I'm scanning the docs, but haven't found anything so far.  Anyone know 
 how to do this(module definition files, maybe?)?
Yup. I create lib files using "implib opengl32.lib opengl32.def", where implib is from the utilities package (ftp://ftp.digitalmars.com/Digital_Mars_C++/Patch/dm812util.zip). If you're lucky, you can produce a library directly from the DLL. If you're not, the form for such a .def file is: LIBRARY <dll filename> EXPORTS <real symbol that D would produce>=<stupid symbol that is in the DLL> ...
OK, this kinda works, (it at least allows it to link) but there are some problems. when the app tries to use any of the files that would need to be loaded from the dll (gethostbyname(char * name) as a simple example) it says that my winsock dll isn't a valid windows image, despite the fact that I only have one of the things, so it must be working right because all of my other network apps are working correctly. Do I need to do all of the export sybols before it will work correctly? Is there some better, more automatic, way to do this? Walter? Evan
Nov 08 2002
parent "Walter" <walter digitalmars.com> writes:
"Evan McClanahan" <evan dontSPAMaltarinteractive.com> wrote in message
news:aqgc05$10ov$1 digitaldaemon.com...
 OK, this kinda works, (it at least allows it to link) but there are some
 problems.  when the app tries to use any of the files that would need to
   be loaded from the dll (gethostbyname(char * name) as a simple
 example) it says that my winsock dll isn't a valid windows image,
 despite the fact that I only have one of the things, so it must be
 working right because all of my other network apps are working
 correctly.  Do I need to do all of the export sybols before it will work
 correctly?  Is there some better, more automatic, way to do this?  Walter?
All I can suggest is start by building a trivial dll, the purpose of which is to get all the mechanics of building, linking, interfacing to, etc., a dll correct and debugged. That way should make it a lot simpler to figure out what is going wrong than with a complex dll.
Dec 09 2002