Link to home
Start Free TrialLog in
Avatar of Paul Sinnema
Paul Sinnema

asked on

Delphi and Tuxedo

I have a C++ headerfile containing the C prototypes for calling functions in a DLL (fml32.dll of Tuxedo). How do I convert these to be used with Delphi?
Avatar of robert_marquardt
robert_marquardt

Send the headers to me (robert_marquardt@gmx.de).
I will give it a try. If the DLL is not too big then add it also.
I am member of Project JEDI (http://delphi-jedi.org). Director to be precise :-)
Please consider donating the conversion.
This might help you get started... you get the idea - it's fairly easy to add more FML32 functions.

The following is extracted from my FML32/ATMI wrapper objects that I have developed for Delphi. Let me know if you need anymore info/examples.

const
  LIBFML32_DLL = 'libfml32.dll';
  LIBWSC_DLL = 'wtuxws32.dll';

  BADFLDID = 0;
  FIRSTFLDID = 0;

  FMINVAL = 0;                        // bottom of error message codes
  FALIGNERR = 1;                      // fielded buffer not aligned
  FNOTFLD = 2;                        // buffer not fielded
  FNOSPACE = 3;                       // no space in fielded buffer
  FNOTPRES = 4;                       // field not present
  FBADFLD = 5;                        // unknown field number or type
  FTYPERR = 6;                        // illegal field type
  FEUNIX = 7;                         // unix system call error
  FBADNAME = 8;                       // unknown field name
  FMALLOC = 9;                        // malloc failed
  FSYNTAX = 10;                       // bad syntax in boolean expression
  FFTOPEN = 11;                       // cannot find or open field table
  FFTSYNTAX = 12;                     // syntax error in field table
  FEINVAL = 13;                       // invalid argument to function
  FBADTBL = 14;                       // destructive concurrent access to field table
  FBADVIEW = 15;                      // cannot find or get view
  FVFSYNTAX = 16;                     // bad viewfile
  FVFOPEN = 17;                       // cannot find or open viewfile
  FBADACM = 18;                       // ACM contains negative value
  FNOCNAME = 19;                      // cname not found
  FEBADOP = 20;                       // operation invalid for field type
  FMAXVAL = 21;                       // top of error message codes

  FLD_SHORT = 0;                      // Short integer
  FLD_LONG = 1;                       // Long integer
  FLD_CHAR = 2;                       // Character
  FLD_FLOAT = 3;                      // single-precision
  FLD_DOUBLE = 4;                     // double precision
  FLD_STRING = 5;                     // null terminated string
  FLD_CARRAY = 6;                     // Binary
                                      // 7 reserved for FLD_INT
                                      // 8 reserved for FLD_DECIMAL
  FLD_PTR = 9;                        // Pointer
  FLD_FML32 = 10;                     // Embedded FML32
  FLD_VIEW32 = 11;                    // Embedded VIEW32

type
// -------------------------------------------------------------------------
  FLDID = longword;
  PFLDID = ^longword;
  FLDLEN = longword;
  PFLDLEN = ^longword;
  FLDOCC = longint;
  PFLDOCC = ^longint;


function fml_getFerror: integer; stdcall; external LIBFML32_DLL name 'getFerror32';
function fml_Fstrerror(err: integer): Pointer; stdcall; external LIBFML32_DLL name 'Fstrerror32';

function fml_Flen(fbfr: Pointer; fieldid: FLDID; occ: FLDOCC): FLDLEN; stdcall; external LIBFML32_DLL name 'Flen32';
function fml_Ftypcvt(tolen: PFLDLEN; totype: integer; fromval: Pointer; fromtype: integer; fromlen: FLDLEN): Pointer; stdcall; external LIBFML32_DLL name 'Ftypcvt32';
function fml_Fadd(fbfr: Pointer; fieldid: FLDID; value: Pointer; len: FLDLEN): integer; stdcall; external LIBFML32_DLL name 'Fadd32';
function fml_Fget(fbfr: Pointer; fieldid: FLDID; occ: FLDOCC; value: Pointer; len: PFLDLEN): integer; stdcall; external LIBFML32_DLL name 'Fget32';
function fml_Fchg(fbfr: Pointer; fieldid: FLDID; occ: FLDOCC; value: Pointer; len: FLDLEN): integer; stdcall; external LIBFML32_DLL name 'Fchg32';

function fml_Finit(fbfr: Pointer; len: FLDLEN): integer; stdcall; external LIBFML32_DLL name 'Finit32';
function fml_Fsizeof(fbfr: Pointer): integer; stdcall; external LIBFML32_DLL name 'Fsizeof32';
function fml_Fused(fbfr: Pointer): integer; stdcall; external LIBFML32_DLL name 'Fused32';
function fml_Funused(fbfr: Pointer): integer; stdcall; external LIBFML32_DLL name 'Funused32';
function fml_Fnum(fbfr: Pointer): integer; stdcall; external LIBFML32_DLL name 'Fnum32';
function fml_Fidxused(fbfr: Pointer): integer; stdcall; external LIBFML32_DLL name 'Fidxused32';

function fml_Foccur(fbfr: Pointer; fieldid: FLDID): integer; stdcall; external LIBFML32_DLL name 'Foccur32';
function fml_FNext(fbfr: Pointer; fieldid: PFLDID; occ: PFLDOCC; value: Pointer; len: PFLDLEN): integer; stdcall; external LIBFML32_DLL name 'Fnext32';

function fml_Fname(fieldid: FLDID): PChar; stdcall; external LIBFML32_DLL name 'Fname32';
function fml_Ftype(fieldid: FLDID): PChar; stdcall; external LIBFML32_DLL name 'Ftype32';
function fml_Fldtype(fieldid: FLDID): integer; stdcall; external LIBFML32_DLL name 'Fldtype32';
function fml_Fldid(fieldname: PChar): integer; stdcall; external LIBFML32_DLL name 'Fldid32';
Avatar of Paul Sinnema

ASKER

How do I implement your code. I've tried to create a Unit with it, but the functions are not know outside the unit. Do I need to import them or something?
Please send me the headers. I am a conversion specialist.
I believe the problem is bit bigger then I expected. I now know how to implement the code above, but I'm not able to connect to Tuxedo. I think this is because I'm unable to us the 'buildclient' process of Tuxedo. How did you implement the connection?
ASKER CERTIFIED SOLUTION
Avatar of zebada
zebada

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
zebada,

Thanks for the effort.

Paul.