Article View: comp.lang.pascal.delphi.misc
Article #597Re: Passing a string to a DLL procedure with PChar
From: Emmanuel Derriey
Date: Thu, 04 Mar 1999 00:00
Date: Thu, 04 Mar 1999 00:00
27 lines
1852 bytes
1852 bytes
Hi ! I think that your procedure is : procedure ProcedureInsideTheDLL (Input:String; var Output:String); and not procedure ProcedureInsideTheDLL (Input:String; Output:String); Nevertheless, you should use PChar arguments ; you must consider that the PChar are allocated by the caller. Example : procedure ProcedureInsideTheDLL (PcharInput:PChar; PCharOutput:PChar); // Don't need the 'var' keyword because it's a allocated pointer var Input : string; Output : string begin Input := string(PCharInput); // string and PChar are compatible // Do something PCharOutput := PChar(Output); end; It should work if enought char are allocated in PCharOutput !!! Else : BOOM ! Hope it will help you... -- Emmanuel Derriey. Windows Software Developer. e-mail : ederriey@at-iris.com
Technical Details
Message-ID:
<7blh68$646$1@ai.alienor.fr>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<2niD2.930$_n2.20928@carnaval.risq.qc.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fd817,37896915cd1a101c X-Google-Attributes: gidfd817,public X-Google-Thread: 108b0b,37896915cd1a101c X-Google-Attributes: gid108b0b,public X-Google-Thread: 10baee,37896915cd1a101c X-Google-Attributes: gid10baee,public X-Google-Thread: 105ac8,37896915cd1a101c X-Google-Attributes: gid105ac8,public X-Google-Thread: f973d,37896915cd1a101c X-Google-Attributes: gidf973d,public X-Google-Thread: 1043cf,37896915cd1a101c X-Google-Attributes: gid1043cf,public From: "Emmanuel Derriey" <jplabbad@aibtp.alienor.fr> Subject: Re: Passing a string to a DLL procedure with PChar Date: 1999/03/04 Message-ID: <7blh68$646$1@ai.alienor.fr> X-Deja-AN: 451087560 References: <2niD2.930$_n2.20928@carnaval.risq.qc.ca> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: Aquitaine Informatique BTP Newsgroups: comp.lang.pascal.delphi.misc,alt.comp.borland-delphi,alt.comp.lang.borland-delphi,alt.lang.delphi,borland.public.delphi.objectpascal,cern.delphi.general