X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=PAbWn0bntXD+EQlp
	9jGHMLWM3Q6dUEUe+P7wwX+g0DLg3i1oorESfPU+HJQo0wYpHh0/CJnKeNqPGdVs
	7DvHmVO/Mvfj4gbIHn8unZnI0V9BlitrGgMo+ps0ph7XyPHQIacCjmgX5TpgvElb
	zjoNjpIBjhoH2Qkaea51PGJ/VZk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=HVop6L0gXH73suN+5dtZHE
	ipUEU=; b=Wj8GETH5oHAVTalbZ0Oy+7aKIcNVjz/3mm+i+VyzDixJZu0i0tGkQo
	ouY0VdLmiAeKOXP3PEX2nF4VTSE0ylRNnosZ1P0JodqQxp5HTr07fhTMjYFKVb8T
	aHev2xyLNRmQPobXJ6Ujm1YKj4cERqbrX9QsFFfmJesMueJiF2LyI=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:c9486fc, dlldll, H*f:sk:gFdeYeZ, UD:dll.dll
X-HELO: mail-wr1-f48.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=20161025;        h=subject:to:references:from:message-id:date:user-agent:mime-version         :in-reply-to:content-transfer-encoding;        bh=G/DFspE5BHXpOVFvmRMwUoNKYMLgOZPzXvcrRebLaxM=;        b=AZFFQR2e33hzjpirGV7LeGDB+EtB38B2YIE9IV4NU4VNUc1lUZH7kLFK9KLeCYd7GU         teJDs+j90ylMgfhjlj/ixFfjSb4Emly6umypDa83AZQkCWBU/bDhl+i/g7VC/rRw4nWK         /zYF4hY7ry1A1yxIdsgyxHVjSSPA8+Zut2WPhp7+Cwk65UdwiGiJUwOFU59pgjWw076g         aik19gsisftcfDD1o+FGSlb9jBo1H7Ghk/HS9DHxbpkW8M+pr3e7JAI82JY+2Al9ZzMf         IBdre9sy4ZcXAHjYgKGoQLGZthOfu7I/75hZJnW0z0LbiJl+kDL3kQghu/dS2mxs5Lsd         YlcA==
Subject: Re: DllMain not called
To: cygwin@cygwin.com
References: <CAJZVxRkk3K6jOtiXUsW6iOFzDAGm4yf393zcYTYphfCKY-qSQg@mail.gmail.com> <c9486fc4-b69f-2704-b759-ce8a5ab23965@gmail.com> <CAJZVxR=gFdeYeZYorqmxOL_BKXcrO22EqsMbteD-h+qT9igngg@mail.gmail.com>
From: Marco Atzeri <marco.atzeri@gmail.com>
Message-ID: <101a7ee1-5ee3-78af-1c1f-ac8b7d97c49b@gmail.com>
Date: Fri, 7 Feb 2020 16:46:32 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2
MIME-Version: 1.0
In-Reply-To: <CAJZVxR=gFdeYeZYorqmxOL_BKXcrO22EqsMbteD-h+qT9igngg@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Am 07.02.2020 um 16:07 schrieb Olivia Nelson:
> I compile it like this:
> gcc dll.c -shared -fPIC -o dll.dll
> 
> I tried to run it with LoadLibraryA
> 
> But DllMain is not called.
> 
> 

you are building a Cygwin dll, that requires the Cygwin1.dll
but probably do you not intend it and need a standalone one that
requires only the MS system dll's.

install the Mingw crosscompiler x86_64-w64-mingw32-gcc.exe
that is in the package

$ cygcheck -f /usr/bin/x86_64-w64-mingw32-gcc.exe
mingw64-x86_64-gcc-core-7.4.0-1

and compile as
x86_64-w64-mingw32-gcc.exe -Wall dll.c -shared -fPIC -o dll.dll

Regards
Marco

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

