X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Message-ID: <48877048.B7BFB5F@dessent.net>
Date: Wed, 23 Jul 2008 10:54:16 -0700
From: Brian Dessent <brian@dessent.net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: Stefano Facchetti <s.facchetti@kline.it>
CC: cygwin@cygwin.com
Subject: Re: Cygwin dll from C# Application
References: <18616035.post@talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Reply-To: cygwin@cygwin.com
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

Stefano Facchetti wrote:

> int MySum(int a, int b)
> {
>    HMODULE h = LoadLibrary("cygwin1.dll");
>    void (*init)() = (void(*)()) GetProcAddress(h,"cygwin_dll_init");
>    init();
> 
>    return a+b;
> }

That is not sufficient to dynamically load the library.  You need to
re-read the part of the FAQ that explains about the scratch area at the
bottom of the stack.

Brian

--
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/

