views:

53

answers:

1

Hello, I am writing a DLL with one function in it. This functions return value is a datatype defined in code within the DLL. On the applications side where I reference the function as an external call to a DLL

Function CreateMyObject( MyString : String ) : TReturnType; external 'MyDLL.dll'

How do I get access from the DLL to the TReturn type so the application will know what type it is supposed to be.

Thank you

+4  A: 

You should define TReturnType in a separate unit and use the unit both in application and dll, ex:

unit SharedUnit;

interface

type
  TReturnType = ...

implementation

end.

In Dll:

library MyDll;

uses
  SharedUnit;

function MyFunc: TReturnType;
begin
// ...
end;

exports MyFunc;

{$R *.res}

begin
end.
Serg