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 Message-ID: From: Heribert Dahms To: "'Demmer, Thomas'" , "'cygwin AT cygwin DOT com'" Subject: RE: Using cygwin DLLs in no-cygwin applications Date: Fri, 17 May 2002 00:00:11 +0200 MIME-Version: 1.0 Content-Type: text/plain Hi Thomas, It's been quite a while since I've last seen Pascal, and fine if it works, but do you want gzip or bzip2? Your code uses gzip, prefixing variables bz doesn't matter! OK, not cygwin specific, but you might have overlooked... Bye, Heribert (heribert_dahms AT icon-scm DOT com) > -----Original Message----- > From: Demmer, Thomas [SMTP:TDemmer AT krafteurope DOT com] > Sent: Thursday, May 16, 2002 09:37 > To: 'cygwin AT cygwin DOT com' > Subject: Using cygwin DLLs in no-cygwin applications > > Hi all, > a while ago I tried to include some legacy FORTRAN and C code into a > DELPHI project of mine. Building a DLL (according to Mummit Khan's > description) seemed the way to go. Under Cygwin, this ended up admiring > SIGSEGVs all over the place. Under MinGW, however, everything worked > out fine (Searching this list would have told me right away that including > > cygwin1.dll from a non-cygwin app does not work). So far for my stupidity. > > > Anyway, more or less out of curiosity I tried the following: > > procedure TForm1.FormCreate(Sender: TObject); > var > bzopen : Function(const name:PChar; const Mode:PChar):Pointer;cdecl; > bzclose: Function(s:Pointer):Integer;cdecl; > bzwrite: Function(s:Pointer;data:Pointer;len:Integer):Integer;cdecl; > hCygz : LongInt; > s : Pointer; > begin > hCygz := LoadLibrary('cygz.dll'); > if hCygz<>0 then begin > @bzopen :=GetProcAddress(hCygz,'gzopen'); > @bzclose:=GetProcAddress(hCygz,'gzclose'); > @bzwrite:=GetProcAddress(hCygz,'gzwrite'); > s := bzopen('test.z','wb9'); > if s<>nil then begin > bzputs(s,PChar('Hello World'); > bzclose(s); > end; > end; > end; > > To my utmost surprise, this piece of code works. After loading cygz I > can even call some functions from cygwin1 after getting their address > with GetModuleHandle/GetProcAddress (malloc/free/getcwd). > > The question now is, which magic initialization does cygz that my self > built DLLs lack? (BTW, I have just written a glue layer for > cygregex.dll that works just after the same scheme...Why?) > > Ciao > Tom > > Thomas Demmer > Kraft Foods R&D Munich > Phone: +49 89 62738-6302 > Fax: +49 89 62738-86302 > -- 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/