From: SMTP%"carsten@software.group.com" 24-OCT-1997 16:23:26.66 To: ntdev CC: Subj: Re: Passing FILE pointers to DLLs Return-Path: owner-ntdev@atria.com Received: by arisia.gce.com (UCX V4.1-12C, OpenVMS V7.1 VAX); Fri, 24 Oct 1997 16:22:17 -0400 Received: from gw.atria.com (gw.atria.com [192.88.237.2]) by mercury.mv.net (8.8.7/mem-951016) with SMTP id UAA05093 for ; Thu, 23 Oct 1997 20:26:20 -0400 (EDT) Received: by gw.atria.com id Thu, 23 Oct 1997 15:32:38 -0400 Received: from software.group.com by gw.atria.com id Thu, 23 Oct 1997 15:32:30 -0400 Received: by merlin.software.group.com id aa09198; 23 Oct 97 15:27 EDT Received: from ariel.group.com(192.52.239.150) by amnesiac via smap (V1.3mjr) id sma009083; Thu Oct 23 15:25:28 1997 Subject: Re: Passing FILE pointers to DLLs To: ntdev Date: Thu, 23 Oct 1997 15:29:06 -0400 (EDT) From: Carsten Schafer In-Reply-To: from "Fallows, Steve" at Oct 23, 97 01:36:59 pm X-Mailer: ELM [version 2.4 PL22] Content-Type: text Message-ID: <9710231529.aa09370@ariel.software.group.com> Sender: owner-ntdev@atria.com Precedence: bulk > > Simple question: (Win32, not strictly NT) > > Can someone explain why I can't fopen a file in my app, > pass the FILE * to a DLL function, then fread it? You have to make sure that both your DLL and your application link with the same run-time library. For example, if your application links with libc.lib and your DLL links with msvcrt.lib then you will not be able to exchange FILE pointers. > > I get an access violation. > > As far as I understand DLL's, they are mapped into my apps address > space, > so the pointer should be good. I traced several levels into the assembly > for fread > and it fails at something called EnterCriticalSection. > > If I pass the string to the DLL it can do the fopen just fine. I just > want > to understand what's going on. > > Thanks for any enlightenment. > > Steven G. Fallows > Manager of Engineering, CMS Division > Bridgeport Machines, Inc. > =========================================================================== | Carsten Schafer Email: carsten@software.group.com | | Senior Software Engineer | | The Software Group Phone: (705) 725-9999 | | 642 Welham Road Fax: (705) 725-9666 | | Barrie, Ontario, Canada L4M 6E7 | | WWW: http://www.group.com/ FTP: ftp.group.com | =========================================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]