Q:  How do I manipulate a TStringList in a DLL?

A:

{ Here is the DLL code. }
library Str_DLL;

uses classes;

procedure AddToStrList(s: string; sList: TStringList); export;
begin
  sList.add(s);
end;

exports
  AddToStrList index 1;

begin
end.

{*************************************}

{ Here is how to use it.  This is from a form that has
two pushbuttons:  one to add a string to a string list,
and one to display the current string list in a list box.
The string to be added comes from a TEdit.  Default names
are used. }
unit Unit1;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  MyStringList: TStringList;

implementation

{$R *.DFM}

procedure AddToStrList(s: string; sList: TStringList);
  far; external 'str_dll';

procedure TForm1.Button1Click(Sender: TObject);
begin
  AddToStrList(edit1.text, MyStringList);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  i: integer;
begin
  listbox1.items.clear;
  listbox1.items.asign(MyStringList);
end;

begin
  MyStringList := TStringList.create;
end.