delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/16/17:55:55

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
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: <BF35D9C143BCCC4EB63181B67C9320C83A9C4C@serv-075.icon-germany.local>
From: Heribert Dahms <heribert_dahms AT icon-scm DOT com>
To: "'Demmer, Thomas'" <TDemmer AT krafteurope DOT com>,
"'cygwin AT cygwin DOT com'"
<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

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/

- Raw text -


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