delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/20/16:37:28

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
To: Christian Lescher <christian AT lescher DOT de>
Cc: cygwin AT cygwin DOT com
Subject: Re: AW: DLL function with string result?
References: <4 DOT 3 DOT 1 DOT 2 DOT 20010420103953 DOT 022a2700 AT pop DOT ma DOT ultranet DOT com>
<4 DOT 3 DOT 1 DOT 2 DOT 20010420122559 DOT 0224b5f0 AT pop DOT ma DOT ultranet DOT com>
<3AE07C0B DOT 928C7680 AT lescher DOT de>
From: Andrew Markebo <flognat AT flognat DOT myip DOT org>
Date: 20 Apr 2001 22:36:26 +0200
In-Reply-To: <3AE07C0B.928C7680@lescher.de>
Message-ID: <m3g0f3qpf9.fsf@master.athome>
Lines: 30
User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7
MIME-Version: 1.0

I would vote for something like you have a function 'dealloc' exported
from the dll that has a function that returns the char* in the first
place.

Have you  tried copying the string by hand?? Sort of.. I mean, could
it be that the implementation of strdup can't handle strings that are
longer than 64k.

Which compiler-platform is it on?? What code does what?? Please answer
that question first!

        /Andy

/ Christian Lescher <christian AT lescher DOT de> wrote:
| I found that in windowsx.h of cygwin/gcc there are the following functions defined:
| 
| #define GlobalAllocPtr(flags,cb) (GlobalLock(GlobalAlloc((flags),(cb))))
| #define GlobalFreePtr(lp) (GlobalUnlockPtr(lp),(BOOL)GlobalFree(GlobalPtrHandle(lp)))
| 
| May these functions also be used for copying a string? How must they be used? (Maybe this works also for string > 64 KB?!)
| Is this also a way for interworking of Borland and Visual?
| 
| Christian
| 
| | char*
| | mallocAndStrCpy (const char* srcStr) {
| |    if (srcStr == NULL)
| |       return NULL;
| |    return strdup(srcStr);
| | }

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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