WSP DLL issues - 4.4.0

View: New views
5 Messages — Rating Filter:   Alert me  

WSP DLL issues - 4.4.0

by Nathan Schulte :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all, I'm trying to compile a simple LSP(Layered Service Provider).

I am having issues with compiling both C and C++ versions of the DLL on my
Windows 7 x64 host.  I am using gcc-4.4.0 and mingwrt-3.16 and w32api-3.13.

The code for both is very simple, and consists of a DLLMain() and a
WSPStartup().  Both output to the file, C:\out, in both DLLMain and WSPStartup,
the C version using the C standard library and the C++ version using the C++
standard library.  The only other differences are extern "C" declarations in the
C++ version.

Now, when compiling using:
   gcc -Wall -shared -o lsp.dll lsp.c -lws2_32
or
   g++ -Wall -shared -o lsp.dll lsp.cpp -lws2_32
I noticed in the dependency viewer that WSPStartup had @xxx appended to it, and
believed this to be a problem.  I followed the directions here:
   http://sei.pku.edu.cn/~caodg/course/c/reference/win32/dll/make.html
To make a "relocatable dll", which also seemed to remove the @xxx suffix, and
only WSPStartup shows in the dependency viewer.  After doing a bit of snooping,
I noticed the --add-stdcall-alias ld option, which produces similar results, but
simply adds WSPStartup while leaving all of the others.  I'm not sure how to
properly do this, but I assume either one of these is correct, and have been
testing both methods as such.

Next, as I could not get my host to work, I tried another available host.  I
installed mingw on a Windows XP x86 host, and compiled using the same methods.
All compilations worked successfully, the C:\out file was created and
successfully appended to.  I did not try the initial two compilations, the ones
without the "relocatable dll" fix described.  I also compiled the C++ version
using MSVC 9.0 (Visual Studio 2008 SP1, I think I am correct in my naming the
compiler MSVC 9.0, but just in case, :P).  This also worked successfully on the
x86 host.

I then proceeded to copy these compiled DLLs and test them on the Windows 7 x64
host, none of them worked.  I attempted to run the MSVC compilation, but made
the mistake of copying the Debug version of the DLL, and I do not have the MSVC
9.0 Debug DLLs (I refuse to install this toolchain on my own hardware).  The
host I used is in a remote location, so I cannot recompile the LSP in Release
mode without effort, but if it is useful, I can surely take the time to do it.

Can someone fill me in on where I have gone awry?  Also, a nice explanation of
what the "relocatable dll" fix is doing (and how it should be done properly)
would be nice (and why the --add-stdcall-alias is slightly different).

Thanks for your time!


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: WSP DLL issues - 4.4.0

by Nathan Schulte :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

After looking at the DLLs again in Dependency Walker, I noticed something that
didn't look right.  The DLLs are showing c:\windows\system32\ws2_32.dll as a
dependency.  On a 64bit machine, that is the 64bit version of ws2_32.dll, the
32bit version is located at c:\windows\syswow64\ws2_32.dll.

Am I correct in my assumption that this dependency setup is an/the issue?




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: WSP DLL issues - 4.4.0

by Tor Lillqvist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Am I correct in my assumption that this dependency setup is an/the issue?

Most likely not. If Dependency Walker is a 32-bit program that doesn't
specifically ask for the automagic translation of pathnames in the
WOW64 environment to be turned off, when it says system32 this
actually means syswow64. 64-bit Windows wants to make the directory
structure to a 32-bit program under WOW64 look like it is on 32-bit
Windows.

--tml

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: WSP DLL issues - 4.4.0

by Nathan Schulte :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tor Lillqvist <tml@...> writes:

> 64-bit Windows wants to make the directory
> structure to a 32-bit program under WOW64 look like it is on 32-bit
> Windows.

Thank you for the clarification, that makes sense.  I'm still stumbling as to
why WSPStartup is never being called.  Perhaps it is the case that you just
can't install 32bit DLLs to the 32bit catalog, and that they must indeed be
64bit DLLs.  This doesn't seem like it would be true, however, as I am able to
install the LSP without the system complaining, which it will normally do if
something isn't correct.

In my last ditch attempt I am going to install Windows 7 x86 and see if my LSP
will work correctly under that host, in addition to compiling under that host
and testing on my Windows 7 amd64 host.

I initially thought I had stumbled upon the answer, that being the placement of
libgcc_s_dw2-1.dll, but this would have no effect on the C version of the LSP,
which also fails to work properly.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: WSP DLL issues - 4.4.0

by Nathan Schulte :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have resolved this issue.  

lpszLspPathAndFile

*PathAndFile*

Doh!


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users