Technical Information Database TI749D.txt Calling a Delphi DLL from C Category :General Programming Platform :All Product :Delphi 1.0 Description: Calling a DLL from your C Code. First create a simple DLL in Delphi: { Begin DLL code } Library MinMax; Function Min(X, Y: Integer): Integer; export; begin if X < Y then Min := X else Min := Y; end; Function Max(X, Y: Integer): Integer; export; begin if X > Y then Max := X else Max := Y; end; Exports Min index 1, Max index 2; begin end. { End DLL code } Then to Call it from your C Code: 1. In your .DEF File add: IMPORTS Min =MINMAX.Min Max =MINMAX.Max 2. In your C application, you must prototype the functions as: int FAR PASCAL Min(int x, y); int FAR PASCAL Min(int x, y); 3. Now you can call Min or Max anywhere in your application. Reference: 7/16/98 4:33:53 PM
Last Modified: 01-SEP-99