www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/05/22/14:38:56

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 54MIcuCQ362908
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 54MIcuCQ362908
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=YaPomsOl
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 20F67385772F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1747939134;
bh=WAI0O9MyOAwyUK6zQOKS+y9KiTC77Zis4iJAqqUtRJA=;
h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=YaPomsOlt4k9TCFEk+wctbk2WaoZJLVkPnGgGIWCG2VLJlO9POv81jAVmF5wVLtUP
s90j9YRwsE1pk7Y8p/XAvSl6uW6RiGvnz1eC3sk4Byp7+QHIk533Wvj0jH0467Hgxj
7BnYhSNU9UFb2p5yYA9IxYlG70sUJ59nxbxjxGvM=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23EA9385780C
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 23EA9385780C
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747939066; cv=none;
b=TwQTOdNYP6dOKIyiW+iaOHJVVe/oZfU7xY5UDvkF+o2OC4RuKNXAaum6cjtGw4/yJEWaT0seJ0vPWGsAryNAlrjJgLqiZmhXVSWemCMke14pIoZ6WEN84ZwvZEhEumUqTYTGYhFn2afn9nWLqyk1t39NNRo2Y7nMVxKK2rqCE84=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1747939066; c=relaxed/simple;
bh=MszAhcGnXnLAdxdahGfWVdTjvD939qX5l5zW9RK7/Jg=;
h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject;
b=ED12zroz9rQ4rfUJQV4Ndgm4wkQyy57voEi9p616dy9957r4fBG8vADqZNlEPRAgtz/PJvDord5Sp2E/CzPMqNf0fzOtyEXgolYEQshJbGVW0JeDe2w/0gpN5olzQj5JjvLcbraGnKt0xXVcm1WlAFSIubTUOqKYJ1GRcdV2nEM=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23EA9385780C
X-Authority-Analysis: v=2.4 cv=TNGOSEla c=1 sm=1 tr=0 ts=682f6ef8
a=qUfFRToiTI0hwv9vP0yqsA==:117 a=qUfFRToiTI0hwv9vP0yqsA==:17
a=dt9VzEwgFbYA:10 a=UXp7rZ135JgA:10 a=r77TgQKjGQsHNAKrUKIA:9
a=LfXesoYgecQmO3mZcMsA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10
a=ap8NrLatpsSKvHGUxTMA:9 a=Hb6VgaHVFo7q2aMk:21 a=_W_S_7VecoQA:10
a=x3vGyVeL1kjphkeRFRfl:22
Message-ID: <5b9f8d4b-0a5a-4aea-99cb-f2c24a6a127a@slipbits.com>
Date: Thu, 22 May 2025 11:37:41 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: cygwin AT cygwin DOT com
Subject: gcc links to libcmain when generating a dll
X-AntiAbuse: This header was added to track abuse,
please include it with any abuse report
X-AntiAbuse: Primary Hostname - box5707.bluehost.com
X-AntiAbuse: Original Domain - cygwin.com
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - slipbits.com
X-BWhitelist: no
X-Source-IP: 70.169.228.116
X-Source-L: No
X-Exim-ID: 1uIAnX-00000001Ufl-2njm
X-Source:
X-Source-Args:
X-Source-Dir:
X-Source-Sender: wsip-70-169-228-116.oc.oc.cox.net ([10.229.33.233])
[70.169.228.116]:51110
X-Source-Auth: home AT slipbits DOT com
X-Email-Count: 1
X-Org: HG=bhshared;ORG=bluehost;
X-Source-Cap: c2xpcGJpdHM7c2xpcGJpdHM7Ym94NTcwNy5ibHVlaG9zdC5jb20=
X-Local-Domain: yes
X-CMAE-Envelope: MS4xfBXmdR/Z2RnD8bBqK23kzSSpXm5yC7sszrHDP99uXxFBez78cIfcz7v3Gh/U4jK9Szv7VqwqovtLTKClNZbfjhvCnYFuOTXhf2aW6BT/HK6XAQ/+Ylws
+AnlQvcNhbm+iQY4UpOAlWqIQZbpmUTrFQeiumKP6AyD/4BwMmlU2npoSJeR3+1dr14wIK8Nrhbe1icrSSfc6H0eDQDZD6EYK3s=
X-Content-Filtered-By: Mailman/MimeDel 2.1.30
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Arthur Schwarz via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Arthur Schwarz <home AT slipbits DOT com>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 54MIcuCQ362908

I can't figure this one out.

 > clear;g++ -flinker-output=dyn -o slip.dll *.o

generates:

/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld: 
/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../lib/libcygwin.a(libcmain.o): 
in function `main':
/usr/src/debug/cygwin-3.6.1-1/winsup/cygwin/lib/libcmain.c:37:(.text.startup+0x79): 
undefined reference to `WinMain'
collect2: error: ld returned 1 exit status

But I am developing a dll, not a windows application. The gcc.pdf manual 
says:

    -flinker-output=type
    This option controls code generation of the link-time optimizer. By
    default the
    linker output is automatically determined by the linker plugin. For
    debugging
    the compiler and if incremental linking with a non-LTO object file
    is desired,
    it may be useful to control the type manually.

    If type is ‘dyn’, code generation produces a shared library. In this
    case ‘-fpic’
    or ‘-fPIC’ is preserved, but not enabled automatically. This allows
    to build
    shared libraries without position-independent code on architectures
    where this
    is possible, i.e. on x86.

My code is not executable and nowhere links to or uses any Windows code. 
It does not have a WinMain method and there is no link to libcmain.o in 
the object folder (*.o does not have libcmain.o).

How do I get rid of this link error?

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019