X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 8 Dec 2010 22:20:26 +0100 Message-ID: Subject: Re: Loading a Cygwin based DLL and calling exported functions From: Reini Urban To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 2010/12/8 James Dickson: > VC++ 10.0 client application: > > int main(int argc, char ** argv) > { > =A0=A0 =A0// 4k scratch space. > =A0=A0 =A0char *stackbase; > =A0=A0 =A0__asm > =A0=A0 =A0{ > =A0=A0 =A0 =A0 =A0mov eax, fs:[4]; > =A0=A0 =A0 =A0 =A0mov stackbase, eax; > =A0=A0 =A0} > > =A0=A0 =A0// Load cygwin dll. > =A0=A0 =A0HMODULE cygwin_ptr =3D LoadLibrary(L"cygwin1.dll"); That's a 4byte scratch space on the stack for the char*, and not 4K. char stackbase[4096]; would fit (untested), but using the padding method from cygload even better. --=20 Reini Urban -- 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