Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: How to compile with gcc/cygwin for "multithreaded DLL" access? Date: Wed, 23 Mar 2005 22:17:20 -0800 Message-ID: <65213341217E8D458E7C78E6640C749504FABFCF@waglmb01.labs.agilent.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: From: To: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j2O6HiVv016523 I have a simple program that compiles and runs fine when built using Visual Studio. It accesses the SICL instrument control DLL (sicl32.dll). The program needs to be compiled with the "Use run-time library: Multithreaded DLL" option on the VS's Project Settings dialog. This executable runs fine and uses the following DLLs: cygcheck Debug/testSicl.exe Debug/testSicl.exe .\SICL32.dll C:\WINDOWS\system32\KERNEL32.dll C:\WINDOWS\system32\ntdll.dll C:\WINDOWS\system32\ADVAPI32.dll C:\WINDOWS\system32\RPCRT4.dll C:\WINDOWS\system32\VERSION.dll C:\WINDOWS\system32\MSVCR70.dll C:\WINDOWS\system32\MSVCRT.dll I can compile and link this same program with gcc (cygwin) but don't know how to specify to gcc that it will use a "Multithreaded DLL". The compile/link looks like: gcc -g -o testSicl -I /cygdrive/c/progra~1/agilent/iolibr~1/c testSicl.c -L . -lsicl32 cygcheck testSicl.exe Found: .\testSicl.exe testSicl.exe C:\cygwin\bin\cygwin1.dll C:\WINDOWS\system32\ADVAPI32.DLL C:\WINDOWS\system32\ntdll.dll C:\WINDOWS\system32\KERNEL32.dll C:\WINDOWS\system32\RPCRT4.dll .\SICL32.dll C:\WINDOWS\system32\VERSION.dll C:\WINDOWS\system32\MSVCR70.dll Note that I needed to make a local copy of SICL32.dll so that I didn't need to have /cygdrive/c/windows/system32 on my command line. testSicl: cygcheck Debug/testSicl.exe When I run it, I successfully invoke the iopen( ) function in the SICL DLL. When I call the iprintf( ) function, it core dumps. Here's the gdb backtrace: ./testSicl gpib0,15 successful open of "gpib0,15" inst=0x00000001 Segmentation fault (core dumped) gdb testSicl GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-cygwin"... (gdb) r gpib0,15 Starting program: /cygdrive/c/dmcp/ieee1588/omniber/testSicl/testSicl.exe gpib0, 15 successful open of "gpib0,15" inst=0x00000001 Program received signal SIGSEGV, Segmentation fault. 0x610ed429 in wmemset () from /usr/bin/cygwin1.dll (gdb) bt #0 0x610ed429 in wmemset () from /usr/bin/cygwin1.dll #1 0x610ebd6c in wmemset () from /usr/bin/cygwin1.dll #2 0x610ebc08 in wmemset () from /usr/bin/cygwin1.dll #3 0x610e7647 in wmemset () from /usr/bin/cygwin1.dll #4 0x610938ef in cygwin1!aclcheck () from /usr/bin/cygwin1.dll #5 0x610064a3 in getprogname () from /usr/bin/cygwin1.dll #6 0x610066b0 in dll_crt0 AT 0 () from /usr/bin/cygwin1.dll #7 0x00000000 in ?? () from (gdb) k Kill the program being debugged? (y or n) y (gdb) q Thanks in advance, - J - Jeff Burch Agilent Laboratories Communications Solutions Department System and Solutions Lab 3500 Deer Creek Rd, M/S 24M-A Palo Alto, CA 94304-1392 e-mail: jeff_burch AT agilent DOT com Phone: 650-485-6364 Fax: 650-485-8092 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/