Translating a C Type to Delphi Type.

Posted on 2004-11-25
Last Modified: 2010-04-05
I have a trouble to translate this type to Delphi. It seem not to working peoperly.
Anyone please help me.

typedef struct {
  unsigned char type;
  union {
    double Double;
    float Float;
    int Int;
    long Long;
    STRING *Str;
#if VERSION_10X > 45
    COMPLEX Complex;
#ifdef VISSIM_H
    struct sig_vec FAR* v;
    MATRIX *m;
    SCALED_INT scaledInt;
  } u;
  struct node_info* n; /* For Version 3.0 */
Question by:wajatimur
    1 Comment
    LVL 6

    Accepted Solution

     PSig_Vec = ^TSig_Vec;
      PMatrix = ^TMatrix;
      PNodeInfo = ^TModeInfo;

       tUnion1 = record
          case byte of
             0: (dbl:Double);
             1: (flt: Single);
             2: (int:Word);
             3: (long: Integer);
             4: (str:  PChar);
             5: (cmpl: TComplex);
             6: (v:  PSig_Vec);
             7: (m: PMatrix);
             8: (scaledInt: TScaledInt);

       TSIGNAL = packed record
          tp: Byte;
          u: tUnion1;
         n: TModeInfo;

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now