X-Recipient: archive-cygwin AT delorie DOT 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:mime-version:date:message-id:subject:from:to :content-type; q=dns; s=default; b=Wvh7oWR/8YP4+Hj1jKb6/PwVEJ293 0M9ou7E4g2UVrEjhs6RCsid3vkiyWCHkl5Ahs505W8oASQjn8ZTaC8ybFRQVFt13 ncAJQpor4Ba+sgOmfrcjdXg8AayYHLxwnHDKbvjz61jI5KlamNXtpORCqEYFnNbL mmaScElNzQbELk= 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:mime-version:date:message-id:subject:from:to :content-type; s=default; bh=ZuS1wnQb91QHivX+RjdDUNgnhEo=; b=HLA 8rCcYCnCY3boXARxo1Am2vX5UVfU76T57keaIlU4CYdQU7MKvAhQ7stlNSnb/5tp 8F3+OqCG9bQZaJDxziEQpIg71/Zqtu9D3bY0EEIRNbeuSOT9TgksW1SpqD0RW1Gm 3McHaHVQFAufCBhKdhVLK0I/EmAiWcti+YjmMM2Q= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-io0-f173.google.com MIME-Version: 1.0 X-Received: by 10.107.137.163 with SMTP id t35mr15082427ioi.61.1449257139710; Fri, 04 Dec 2015 11:25:39 -0800 (PST) Date: Fri, 4 Dec 2015 14:25:39 -0500 Message-ID: Subject: another LoadLibrary question / crash (sorry) From: Mike Giancola To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Hi, I apologize for asking the same question that has been asked so many times - but I'm stuck. I have a DLL built in Cygwin that I'm trying to call from a program compiled in Visual Studio 2012. When I call LoadLibrary it's successful, however calls to the APIs crash the program. From what I've read, I understand I need to allocate "4k of scratch space at the bottom of the stack" and call the cygwin_dll_init first. (From https://cygwin.com/faq/ section 6.19). I haven't been able to find the how-cygtls-works.txt nor winsup/testsuite/cygload - most of the links in old mail archives are dead (some messages go back to 2007). That said, I've found cygload.cc here: https://raw.githubusercontent.com/openunix/cygwin/master/winsup/testsuite/winsup.api/cygload.cc Here, the code attempts to use some assembly to set the stack size: #ifdef __GNUC__ __asm__ ( "movl %%fs:4, %0" :"=r"(stackbase) ); #else __asm { mov eax, fs:[4]; mov stackbase, eax; } #endif However these lines crash the program. I've downloaded these exact files (the .cc & .h) and compiled them using VS2012. When debugged / run i get an access violation and crash. Note - i'm trying to run this program as is, unmodified. Is there a specific compiler flag i need to set in order to allow these operations? I've turned off DEP, i've tried both set the entry point to be cygloadCRTStartup then going back - reseting the entry point and uncommenting the construction of the padding object line. Both fail. Does anyone happen to have a simple example - simply calling a "fooapi" within a dll available? Is there any updated documentation anywhere? Thanks for the help! mike -- 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