Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com From: Tor Lillqvist Message-ID: <14357.19234.260000.687903@gargle.gargle.HOWL> Date: Tue, 26 Oct 1999 09:33:06 +0300 (FLE Daylight Time) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="pkgIeSa44J" Content-Transfer-Encoding: 7bit To: Dongho Kim - Experimental Account Cc: cygwin AT sourceware DOT cygnus DOT com Subject: Using Cygwin created DLL in MSVC++? In-Reply-To: <199910260407.VAA16329@boreas.isi.edu> References: <199910260407 DOT VAA16329 AT boreas DOT isi DOT edu> X-Mailer: VM 6.73 under Emacs 20.4.1 --pkgIeSa44J Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit Dongho Kim - Experimental Account writes: > - Is it possible to uses DLLs that are created using Cygwin > from a program created using MS VC++? Yes, but only if the DLL are created using (tools running under) cygwin, but not use the cygwin dll itself. I.e. they should be "mingw32" DLLs, created using gcc -mno-cygwin. If you share data structures with the MSVC-compiled code, use -fnative-stuct also. (This is available only in gcc-2.95 and later.) It probably also is necessary to use the same MS C runtime in the DLL and program, ie if the program uses msvcrt.dll, you should set up your gcc to produce bnaries that use it, too, and not crtdll.dll, which is the default. This might be a bit convoluted. I think it was enough to edit the specs file. My specs file included here: --pkgIeSa44J Content-Type: text/plain Content-Description: specs for gcc-2.95 with msvcrt Content-Transfer-Encoding: 7bit *asm: *asm_final: *cpp: -remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__} %{mno-cygwin:-iwithprefixbefore ../../../../%(mingw_include_path)/include/mingw32 -D__MSVCRT__ -D__MINGW32__=0.2} *cc1: %(cc1_spec) *cc1plus: *endfile: *link: %{mwindows:--subsystem windows} %{mconsole:--subsystem console} %{mdll:--dll -e _DllMainCRTStartup AT 12} *lib: %{pg:-lgmon} %{!mno-cygwin:-lcygwin} %{mno-cygwin:-lmingw32 -lmoldname-msvc -lmsvcrt} %{mwindows:-lgdi32 -lcomdlg32} -luser32 -lkernel32 -ladvapi32 -lshell32 *libgcc: -lgcc *startfile: %{mdll: %{mno-cygwin:dllcrt2%O%s}} %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:crt2%O%s} %{pg:gcrt0%O%s}} *switches_need_spaces: *signed_char: %{funsigned-char:-D__CHAR_UNSIGNED__} *predefines: -Di386 -D_WIN32 -DWINNT -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: 2.95 *multilib: . !mno-cygwin;mingw32 mno-cygwin; *multilib_defaults: *multilib_extra: *multilib_matches: mno-cygwin mno-cygwin; *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_586) *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: i586-cygwin32 *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*} }}}}}} --pkgIeSa44J Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit > - Is there any way that I can debug this? Not really, I guess. > - Is there any document that explains about DLL in detail? Sorry, I don't think there is any really good one. > There must be many people who tried this. > (Use Cygwin created DLLs in MS VC++.) "Use in MS VC++" is a bit vague (as I said, you can't debug them in the MS VC++ debugger), but I certainly have used gcc-compiled DLLs from MSVC-compiled code, and vice versa. --tml --pkgIeSa44J Content-Type: text/plain; charset=us-ascii -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com --pkgIeSa44J--