Mail Archives: cygwin/2001/03/22/07:33:22
--------------CA4EF8263D72616EF6ED5096
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Nate Lawson wrote:
>
> On Wed, 21 Mar 2001, Earnie Boyd wrote:
> > Nate Lawson wrote:
> > >
> > > On Wed, 21 Mar 2001, Earnie Boyd wrote:
> > > > Nate Lawson wrote:
> > > > >
> > > > > Thanks for the help getting the dll to compile. It worked. However, I'm
> > > > > still having linking problems.
> > > > >
> > > > > 1. Does it matter whether a DLL is linked in character or windows
> > > > > mode? (It makes no GDI calls).
> > > > > 2. Should I use gcc -shared or gcc -mdll to build?
> > > > > 3. Why can't it find dllcrt2.o? I've tried adding -lmsvcrt or -ldllcrt
> > > > > but no luck.
> > > > >
> > > > > Here is my linking line:
> > > > > gcc -mwindows -mno-cygwin -DDBG -s -Wl,--out-implib,Packet.a
> > > > > -mdll -o Packet.dll Packet.def Packet32.o -L /usr/lib/mingw
> > > > > /usr/lib/gcc-lib/i686-pc-cygwin/gcc-2.95.2-9/../../../../i686-pc-cygwin/bin/ld:
> > > > > cannot open dllcrt2.o: No such file or directory
> > > > > collect2: ld returned 1 exit status
> > > > > make: *** [main] Error 1
> > > > >
> > > >
> > > > Did you install the mingw package? The -mno-cygwin indicates to gcc
> > > > that you want to build mingw programs.
> > > >
> > > > Earnie.
> > >
> > > Indeed I did:
> > >
> > > $ ls -l /usr/lib/mingw/
> > > total 801
> > > -rw-r--r-- 1 xx 544 390 Jan 30 15:23 CRT_noglob.o
> > > -rw-r--r-- 1 xx 544 1899 Jan 30 15:23 crt1.o
> > > -rw-r--r-- 1 xx 544 1989 Jan 30 15:23 crt2.o
> > > -rw-r--r-- 1 xx 544 379 Jan 30 15:23 crtmt.o
> > > -rw-r--r-- 1 xx 544 379 Jan 30 15:23 crtst.o
> > > -rw-r--r-- 1 xx 544 628 Jan 30 15:23 dllcrt1.o
> > > -rw-r--r-- 1 xx 544 628 Jan 30 15:23 dllcrt2.o
> > > -rw-r--r-- 1 xx 544 62322 Jan 30 15:23 libcoldname.a
> > > -rw-r--r-- 1 xx 544 297594 Jan 30 15:23 libcrtdll.a
> > > -rw-r--r-- 1 xx 544 7248 Jan 30 15:23 libmingw32.a
> > > -rw-r--r-- 1 xx 544 1934 Jan 30 15:23 libmingwthrd.a
> > > -rw-r--r-- 1 xx 544 63402 Jan 30 15:23 libmoldname.a
> > > -rw-r--r-- 1 xx 544 406408 Jan 30 15:23 libmsvcrt.a
> > > -rw-r--r-- 1 xx 544 398358 Jan 30 15:23 libmsvcrt20.a
> > > -rw-r--r-- 1 xx 544 390724 Jan 30 15:23 libmsvcrt40.a
> >
> > Hmm... What happens if you
> > gcc -L /usr/lib/mingw -mwindows -mno-cygwin -DDBG -s
> > -Wl,--out-implib,Packet.a
> > -mdll -o Packet.dll Packet.def Packet32.o
> > instead. The -L switch is position dependent, although it shouldn't be
> > required.
>
> Same thing. Also same thing if I remove the -L completely. I've also
> tried -lmsvcrt, -lcrtdll, and every other lib in the /usr/lib/mingw
> directory -- all same error. I cannot get -mno-cygwin to link this DLL.
>
> BTW, I was able to get it to link by removing -mno-cygwin but this creates
> a DLL that crashes my application. If I use the same DLL compiled under
> MSVC, the app works fine with no recompilation.
>
Ok, I think I've found the problem. I've attached a specs.new file.
Save it to /tmp/specs.new and try
gcc -mwindows -mno-cygwin -DDBG -s -Wl,--out-implib,Packet.a -mdll \
-o Packet.dll Packet.def Packet32.o -specs=/tmp/specs.new
and report the result.
Earnie.
--------------CA4EF8263D72616EF6ED5096
Content-Type: text/plain; charset=us-ascii;
name="specs.new"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="specs.new"
*asm:
*asm_final:
*cpp:
%{mno-win32: %{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} %(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{mthreads:-D_MT} -isystem /usr/include/mingw/g++-3 -isystem /usr/include/mingw/g++ -isystem /usr/local/include/mingw -idirafter /usr/include/mingw} %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -isystem /usr/local/include -idirafter /usr/include} %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT -idirafter /usr/include/w32api}
*cc1:
%(cc1_spec)
*cc1plus:
*endfile:
*link:
%{mwindows:--subsystem windows} %{mconsole:--subsystem console} %{shared: %{mdll: %eshared and mdll are not compatible}} %{shared: --shared} %{mdll:--dll} %{static:-Bstatic} %{!static:-Bdynamic} %{shared|mdll: -e %{mno-cygwin:_DllMainCRTStartup AT 12} %{!mno-cygwin:__cygwin_dll_entry AT 12}} --dll-search-prefix=cyg
*lib:
%{pg:-lgmon} %{!mno-cygwin:-lcygwin} %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} %{mwindows:-lgdi32 -lcomdlg32} -luser32 -lkernel32 -ladvapi32 -lshell32
*libgcc:
%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc %{mno-cygwin:-lmoldname -lmsvcrt}
*startfile:
%{shared|mdll: %{mno-cygwin:-L/usr/lib/mingw mingw/dllcrt2%O%s}} %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:-L/usr/lib/mingw mingw/crt2%O%s} %{pg:gcrt0%O%s}}}
*switches_need_spaces:
*signed_char:
%{funsigned-char:-D__CHAR_UNSIGNED__}
*predefines:
-Di386 -D__386__ -D__i386 -D_X86=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -Asystem(winnt) -Acpu(i386) -Amachine(i386)
*cross_compile:
0
*version:
gcc-2.95.2-9
*multilib:
. ;
*multilib_defaults:
*multilib_extra:
*multilib_matches:
*linker:
collect2
*cpp_486:
%{!ansi:-Di486} -D__i486 -D__i486__
*cpp_586:
%{!ansi:-Di586 -Dpentium} -D__i586 -D__i586__ -D__pentium -D__pentium__
*cpp_k6:
%{!ansi:-Di586 -Dk6} -D__i586 -D__i586__ -D__k6 -D__k6__
*cpp_686:
%{!ansi:-Di686 -Dpentiumpro} -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__
*cpp_cpu_default:
%(cpp_686)
*cpp_cpu:
-Acpu(i386) -Amachine(i386) %{!ansi:-Di386} -D__i386 -D__i386__ %{mcpu=i486:%(cpp_486)} %{m486:%(cpp_486)} %{mpentium:%(cpp_586)} %{mcpu=pentium:%(cpp_586)} %{mpentiumpro:%(cpp_686)} %{mcpu=pentiumpro:%(cpp_686)} %{mcpu=k6:%(cpp_k6)} %{!mcpu*:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}
*cc1_cpu:
%{!mcpu*: %{m386:-mcpu=i386 -march=i386} %{m486:-mcpu=i486 -march=i486} %{mpentium:-mcpu=pentium} %{mpentiumpro:-mcpu=pentiumpro}}
*mingw_include_path:
i686-pc-cygwin
*link_command:
%{!fsyntax-only: %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %D %o %{!nostdlib:%{!nodefaultlibs:%G %L %G}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*}
}}}}}}
--------------CA4EF8263D72616EF6ED5096
Content-Type: text/plain; charset=us-ascii
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
--------------CA4EF8263D72616EF6ED5096--
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
- Raw text -