{Important note about DLL memory management: ShareMem must be the
The first unit in your library 's USES clause AND your project' s (select
The Project - the View Source) USES clause if your DLL exports any procedures or
Functions provides that pass strings as parameters or function results. This
Applies to all strings passed to and from your DLL - even those that
Are nested in records and classes. ShareMem is the interface unit to
The BORLNDMM. DLL Shared memory manager, which must be deployed along
With your DLL. To get the using BORLNDMM. DLL, pass the string information
Using PChar or ShortString parameters.}
USES the
Windows, SysUtils, Classes, Forms, RichView, RVEdit, RVStyle;
The type r=an Array Of byte;
The function ReadRtfString (var cbytes: an Array Of byte) : string; Stdcall;
Var sm: TMemoryStream;
RVE: TRichViewEdit;
The RTF: r;
STR: string;
The begin
Sm:=TMemoryStream. Create;
Sm. SetSize (Sizeof (cbytes));
Sm. WriteBuffer (cbytes, Sizeof (cbytes));
RVE. LoadRVFFromStream (sm);
RVE. Format;
Sm. The Clear;
RvE. SaveRTFToStream (sm, true);
Sm. ReadBuffer (RTF, sm. Size);
Move (RTF [0], STR [1], the Length (RTF));
Result:=STR;
end;
Exports
ReadRtfString index 1;
The begin
End.
This code is written to a total of.net calls, RVE suggest not initialize,, how to initialize
CodePudding user response:
VarSTR: string;
Result:=STR;
Stack variables in the return value to do! Will be released from the end of the process as well.
CodePudding user response: