X-Spam-Check-By: sourceware.org Message-ID: <443095C7.7030606@cygwin.com> Date: Sun, 02 Apr 2006 23:25:59 -0400 From: "Larry Hall (Cygwin)" Reply-To: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20051223 Fedora/1.5-0.2.fc4.remi Thunderbird/1.5 Mnenhy/0.7.3.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Initialisation with data from dll-libraries References: <442FF2BB DOT 10307 AT cygwin DOT com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Jørgen Steensgaard-Madsen wrote: > Larry Hall (Cygwin cygwin.com> writes: > >> Jørgen Steensgaard-Madsen wrote: >>> Asking for help. >> You haven't said where the dispatch table is or how it is supposed to filled >> in. > > First of all, thanks for reacting so promptly. > > The dispatch table is an array of pointers in a C-program file to be linked > against the libraries. Initialised is expressed as a usual array declaration > initialised with individual entries given as > > &some_function > > where some_function is declared as extern in the same file. This methods works > nicely with static linkage, and also with dynamic linkage on a Linux box. Windows DLLs don't work the same as shared objects. If you want to call functions in a particular DLL, you can link your program against an import library for the DLL which contains the functions you'll be using. The import library provides the stubs for the functions that allow your program to link. At run-time, they ferry your calls across to the DLL implementation. If you don't want this, you can use dlopen and dlsym to programmatically load the DLL with the functions you want to call and get the function pointers. You may be able to adapt the former approach to your existing code with few changes. If that sounds preferable to you, I suggest you read up on Windows DLLs, importing/exporting functions, and import libraries. If you'd prefer the latter route, which is completely portable to Unix/Linux once you've made the initial code changes, I'd recommend reading up on dlopen and dlsym. In either case, neither of these subjects is Cygwin-specific so further discussion of these general areas are really off-topic for this list. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 838 Washington Street (508) 893-9889 - FAX Holliston, MA 01746 -- 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/