View previous topic :: View next topic |
Author |
Message |
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Wed Apr 26, 2006 10:55 pm Post subject: |
|
|
I tried the latest drop, Eric, and got a little further than before
Loading mango.lib now works, but a GPF is thrown when the "executable" is being bound (I guess). So, I stripped some things down until I got to mango.io.Socket ~ which needs wsock32 (on Windows) to run. So, I added that to the list of libraries, but DDL refuses to load it. An error is thrown saying "can't find library wsock32.lib", although it's right there with the others.
It's odd, because there's no problem loading user32.lib, or kernel32.lib ... |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Thu Apr 27, 2006 7:36 am Post subject: |
|
|
kris wrote: | I tried the latest drop, Eric, and got a little further than before
Loading mango.lib now works, but a GPF is thrown when the "executable" is being bound (I guess). So, I stripped some things down until I got to mango.io.Socket ~ which needs wsock32 (on Windows) to run. So, I added that to the list of libraries, but DDL refuses to load it. An error is thrown saying "can't find library wsock32.lib", although it's right there with the others.
It's odd, because there's no problem loading user32.lib, or kernel32.lib ... |
Are you explicitly loading wsock32.lib via DDL?
It could be that the user32.lib and kernel32.lib parts are integrated into your .exe before you even start, thanks to dependencies that your core executable has. Check the symbol listing from your .map or .situ file and I think you'll find that kernel32 and user32 are statically linked.
As for wsock32, I'll develop a test case for this and work on it. As a workaround, try to coerce wsock32 to be statically linked into your .exe. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Thu Apr 27, 2006 10:18 am Post subject: |
|
|
yes; explicitly loading wsock32.lib via DDL, loadAndRegister(). I just noticed that the code below eats the exception text -- I'll check that right now ...
Code: | module host;
import std.stdio;
import ddl.Linker,
ddl.DefaultRegistry;
import utils.ArgParser;
int main (char[][] args)
{
int ret;
if (args.length > 1)
{
// load the statically-linked symbols for this executable
auto linker = new Linker (new DefaultRegistry);
linker.loadAndRegister ("host.ddl");
// get dash prefixed args
ArgParser parser = new ArgParser;
parser.bind ("-", "l", delegate uint(char[] value) {
try {
writefln ("loading '?s'", value);
linker.loadAndRegister (value);
} catch (Exception)
{writefln ("cannot find library '?s'", value);}
return value.length;
});
parser.parse (args[2..$]);
// load the application file
auto app = linker.loadAndLink (args[1]);
// and locate the entry point
auto entry = app.getDExport!(void function(Linker, char[][]), "app.entry")();
try {
entry (linker, args[1..$]);
} catch (Object o)
{
ret = -1;
throw o;
}
}
else
writefln ("usage is: host AppPath [-lLibName] [args]");
return ret;
} |
|
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Thu Apr 27, 2006 10:22 am Post subject: |
|
|
OK, the exception thrown for wsock32.lib is an "end of input" error |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Thu Apr 27, 2006 10:25 am Post subject: |
|
|
kris wrote: | yes; explicitly loading wsock32.lib via DDL, loadAndRegister(). I just noticed that the code below eats the exception text -- I'll check that right now ... [snip]
|
I like that. Just pass call with "-lphobos.lib -lsnn.lib" and you're in business. Nice.
The only thing I can think of then is that its still an OMF and/or implib problem with loading winsock, which is nothing really new - I just need more tests and benchmarks to bring the code quality up I'm afraid, so thanks!!
Also, does winsock load properly via ddlinfo? Typically, that's the fastest way to determine if the problem is with a loader or the linker.
Again, thanks for the feedback Kris. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Thu Apr 27, 2006 10:39 am Post subject: |
|
|
pragma wrote: | Also, does winsock load properly via ddlinfo? |
I'm afraid I don't understand. You'll need to step me through that one |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Thu Apr 27, 2006 10:42 am Post subject: |
|
|
kris wrote: | pragma wrote: | Also, does winsock load properly via ddlinfo? |
I'm afraid I don't understand. You'll need to step me through that one |
just run
ddlinfo wsock32.lib
and see what happens. ddlinfo should be found in the utils directory. |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Thu Apr 27, 2006 10:55 am Post subject: |
|
|
Thanks, Larsivi.
Code: | C:\d\mango\example\WebServer>ddlinfo wsock32.lib
Error: end of input
C:\d\mango\example\WebServer> |
|
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Thu Apr 27, 2006 11:40 am Post subject: |
|
|
kris wrote: | Thanks, Larsivi.
Code: | C:\d\mango\example\WebServer>ddlinfo wsock32.lib
Error: end of input
C:\d\mango\example\WebServer> |
|
I've opened a ticket for this, as its obviously a bug:
http://www.dsource.org/projects/ddl/ticket/46#preview
Don't worry about compiling with -debug or anything like that. I should be able to reproduce it easily enough. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Sat Apr 29, 2006 11:38 am Post subject: |
|
|
Kris, I have a patch in SVN now that should do the trick - the current SDK and utils links include the changes. The ticket link has more information as to what was fixed - basically it was a one-liner.
I had zero trouble running the following:
Code: |
examples\host examples\mule.obj -lphobos.lib -lsnn.lib -lwsock32.lib
|
Enjoy. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Sat Apr 29, 2006 5:54 pm Post subject: |
|
|
Thanks ... now I'll go and break it |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Sat Apr 29, 2006 6:19 pm Post subject: |
|
|
Spoke too soon ~ downloaded the latest zips, rebuilt everything, and now the mule.d that previously worked no longer does anything. Host.exe just loads up the libraries and quits (no message) |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Sat Apr 29, 2006 7:42 pm Post subject: |
|
|
Quote: | Thanks ... now I'll go and break it |
And that's why I can count on you Kris. Seriously, thanks for helping out.
This is all just strange. I had to double-check to make sure that I was getting valid output:
Code: | loading 'phobos.lib'
loading 'snn.lib'
loading 'wsock32.lib'
Mule loaded!
0 = examples\mule.obj
1 = -lphobos.lib
2 = -lsnn.lib
3 = -lwsock32.lib
Done. |
Looks like I should put the old windows box back online for validation purposes. Something isn't right here.
I did make a subtle change to the buildexamples.d script - did you rebuild that as well? (yea, yea, I should've mentioned that earlier) _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Sat Apr 29, 2006 8:34 pm Post subject: |
|
|
Right now it's a bit of a hassle to switch back and forth between Phobos and Ares, because I've got my environment all torn asunder. The issue I ran into may reflect this state of flux, since I have made a few silly blunders recently
Will retry when things stablize again.
BTW, you already know that DDL doesn't yet compile under Ares ~ I guess it is just the zlib stuff that's missing? If so, then I'll pester Sean about that |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Sun Apr 30, 2006 10:55 am Post subject: |
|
|
kris wrote: | Right now it's a bit of a hassle to switch back and forth between Phobos and Ares, because I've got my environment all torn asunder. The issue I ran into may reflect this state of flux, since I have made a few silly blunders recently
Will retry when things stablize again. |
Take your time. I'm going to set up a secondary windows environment so I can better validate things. Perhaps Box #2 will be the Ares test area.
Quote: |
BTW, you already know that DDL doesn't yet compile under Ares ~ I guess it is just the zlib stuff that's missing? If so, then I'll pester Sean about that |
I am aware of this, and have given the situation some thought. DDL has a little ways to go before it's 100? ready for Ares. FYI, the project currently has the following dependencies:
- std.zip for the up-and-coming zip loader and various sdk utils
- std.demangle - to stay in lock-step with spec changes
- std.moduleinit - for DMD/ABI compatbility for module initalization (Linker.d)
For what it's worth, I personally find the utiltiy of std.zip to be justification enough for having it in an emerging library like Ares - its just nice to be able to work with a (de facto) standard compression type out of the box. As for my thoughts on the matter, I'm of two minds about where std.zip should go.
On the one hand, we could just use the phobos version outright. Sean could even do a nice thing here and use the most recent zlib binary and make the improvements available to Walter for inclusion into Phobos.
On the other hand, having that extra C lib linkage in a standard library kind of flies in the face of that old "eat your own dogfood" addage. It would be *really* nice to have that library 100? ported over to D just to make life a little easier. I've looked at the source before, and its a bit involved, but the headers seem to be pretty free of macros, so bringing it over wouldn't be a huge undertaking. Its also fairly mature software, so I doubt a port would ever fall far behind the main C release. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
|