delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/11/06/11:47:46

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3BE80EAC.50400@ece.gatech.edu>
Date: Tue, 06 Nov 2001 11:24:12 -0500
From: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2
X-Accept-Language: en-us
MIME-Version: 1.0
To: David Westbury <David DOT Westbury AT ipaper DOT com>
CC: cygwin AT cygwin DOT com
Subject: Re: DLL's for Dummies
References: <OF277487F1 DOT DD007F3A-ON85256AFC DOT 004B9C63 AT ipaper DOT com>

Where are you getting the declarations of the functions within the dll 
(e.g. the header files)?  It sounds like myprog.o is getting compiled 
without declaring the functions/variables imported from the DLL as 
"__declspec(dllimport)".  This omission *could* cause the problems you are 
seeing.

If you are using "MSVC-ish" header files that came with your third party 
DLL, you *MAY* need to rewrite them somewhat for use with cygwin.

--Chuck

David Westbury wrote:

> I recently got started with Cygwin. What a great package! Coming from a
> Unix programming background I'm completely in the dark about DLL's. I need
> to write C programs that access a third party API. I'm experimenting with
> gcc but having disappointing results. I'm trying to compile and run an
> example C program that came with the third party API package. Although I
> don't know how to compile a program against a DLL I've found that the gcc
> string below results in an error free compile/link. The resulting
> executable runs to some degree. Some API calls execute correctly. However
> using the gdb debugger it appears that random memory locations are being
> modified as I step through the program. The program employs elements of a
> structure as arguments to the API calls. The debugger shows that, in
> addition to modifying the correct structure elements, random elements of
> the structure are also being modified as I step over many of the API calls.
> Also memcpy() appears to produce similar memory corruption. I'm hoping this
> will ring a bell with someone who can guide me in the right direction.
> 
> Here is the gcc string I'm using:
> 
> gcc  -g   myprog.c  -o myprog   /path to third party dll/api.dll
> 
> I've been working with this for days.  Forgive me if I haven't read the
> right FAQ or documentation. I've scanned about everything I can find. Any
> help would be greatly appreciated. Thanks.
> 
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 
> 



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019