From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,47a4be9898f849f0 X-Google-Attributes: gid103376,public From: "bob" Subject: Re: Linking FORTRAN77 to Ada83 Date: 1999/06/10 Message-ID: <7jofr8$qjt@dfw-ixnews5.ix.netcom.com> X-Deja-AN: 487911350 References: <375ECA88.CF7CFF7E@sll.northrop.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Organization: B & D Associates X-NETCOM-Date: Thu Jun 10 8:50:32 AM CDT 1999 X-MSMail-Priority: Normal Newsgroups: comp.lang.ada Date: 1999-06-10T08:50:32-05:00 List-Id: Here is an Ada spec for currently running code. Compiles and runs on GNAT for IRIX(SGI) and Linux (Intel) ___________________________ -- %@(#)fortran_interface_s.a 1.3% %02 Mar 1998% - SCCS Control Line -- 1.2 09-Feb-98 dab Added Stereo to Mono feedback with Global_Defs; with Interfaces.Fortran; with Los_Vectors; with OSM_Defs; with Vectors; with Unchecked_Deallocation; package Fortran_Interface is package Fortran renames Interfaces.Fortran; package GD renames Global_Defs; package vec renames vectors; package LV renames Los_Vectors; package OD renames OSM_Defs; type Fortran_Truth_Type is record Time : GD.Epoch_Time_Type := 0.0; State : LV.State_ECI_Type; Unit_LOS : VEC.Vector(1..3) := (others => 0.0); Intensity : GD.Real := 0.0; Tgtid : GD.Int := 0; Class_Id : GD.Int := 1; Phase_Id : GD.Int := 1; end record; for Fortran_Truth_Type use record Time at 0 range 0..63; State at 0 range 64..639; Unit_LOS at 0 range 640..831; Intensity at 0 range 832..895; Tgtid at 0 range 896..927; Class_Id at 0 range 928..959; Phase_Id at 0 range 960..991; end record; type Fortran_Scan_Execution_type is record TFirst_Scan : GD.Epoch_Time_type := 0.0; TLast_Scan : GD.Epoch_Time_type := 0.0; Scan_Pointer : vec.vector(1..3) := (others => 0.0); Platform_State : LV.State_Eci_Type := (others => (others => 0.0)); Azfirst : GD.Real := 0.0; Azlast : GD.Real := 0.0; Sweep_Rate : GD.Real := 0.0; Sensor_ID : GD.Int := 0; Scan_ID : GD.Int := 0; Platform_Id : GD.Int := 0; Execute : GD.Boolean_Type := False; end record; for Fortran_Scan_Execution_type use record TFirst_Scan at 0 range 0..63; TLast_Scan at 0 range 64..127; Scan_Pointer at 0 range 128..319; Platform_State at 0 range 320..895; Azfirst at 0 range 896..959; Azlast at 0 range 960..1023; Sweep_Rate at 0 range 1024..1087; Sensor_ID at 0 range 1088..1119; Scan_ID at 0 range 1120..1151; Platform_Id at 0 range 1152..1183; Execute at 0 range 1208..1215; end record; type Fortran_Scan_Execution_Access_type is access Fortran_Scan_Execution_type; type Fortran_Sensor_Header_type is record NLOS : GD.Int := 0; Scan_Execution : Fortran_Scan_Execution_type; end record; for Fortran_Sensor_Header_type use record NLOS at 0 range 0..31; Scan_Execution at 0 range 64..1279; end record; type Fortran_Sensor_Header_Access_type is access Fortran_Sensor_Header_type; type Fortran_LOS_Vector_type; type Fortran_LOS_Vector_Access_type is access Fortran_LOS_Vector_type; type Fortran_LOS_Vector_type is record Epoch : GD.Epoch_Time_type := 0.0; platstate : LV.State_Eci_Type; Boresight : VEC.Vector(1..3) := (others => 0.0); Unit_LOS : VEC.Vector(1..3) := (others => 0.0); Unit_LOS_Rate : vec.vector(1..3) := (others => 0.0); -- Udot vec Unit_LOS_Accel : vec.vector(1..3) := (others => 0.0); -- Udotdot Intensity : GD.Real := 0.0; Second_Moments_ECI : VEC.Vector(1..3) := (others => 0.0); AMA_ECI : VEC.Vector(1..3) := (others => 0.0); RMA : GD.Real := 0.0; Position_UV : vec.vector(1..2) := (others => 0.0); Velocity_UV : vec.vector(1..2) := (others => 0.0); Acceleration_UV : vec.vector(1..2) := (others => 0.0); -- 06/12/95 Second_Moments_UV : VEC.Vector(1..3) := (others => 0.0); AMA_UV : VEC.Vector(1..3) := (others => 0.0); -- uv coordinates truth : Fortran_Truth_Type; Platform_ID : GD.Platform_ID_type := GD.Platform_ID_Type'First; Detection_ID : GD.Int := 0; Sensor_ID : GD.Int := 0; Sensor_Band : GD.Int := 0; Scan_ID : GD.Int := 0; LOS_ID : GD.Int := 0; Score_Type_Obj : GD.Int := 0; osm_type : GD.Int := 0; Num_Asso_Mono : GD.Int := 0; -- # of mono tracks using this Associated : Boolean := False; end record; for Fortran_LOS_Vector_type use record Epoch at 0 range 0..63; platstate at 0 range 64..639; Boresight at 0 range 640..831; Unit_LOS at 0 range 832..1023; Unit_LOS_Rate at 0 range 1024..1215; Unit_LOS_Accel at 0 range 1216..1407; Intensity at 0 range 1408..1471; Second_Moments_ECI at 0 range 1472..1663; AMA_ECI at 0 range 1664..1855; RMA at 0 range 1856..1919; Position_UV at 0 range 1920..2047; Velocity_UV at 0 range 2048..2175; Acceleration_UV at 0 range 2176..2303; Second_Moments_UV at 0 range 2304..2495; AMA_UV at 0 range 2496..2687; truth at 0 range 2688..3679; -- Fortran seems to allign this next field on an 8 byte boundary Platform_ID at 0 range 3712..3743; Detection_ID at 0 range 3744..3775; Sensor_ID at 0 range 3776..3807; Sensor_Band at 0 range 3808..3839; Scan_ID at 0 range 3840..3871; LOS_ID at 0 range 3872..3903; Score_Type_Obj at 0 range 3904..3935; osm_type at 0 range 3936..3967; Num_Asso_Mono at 0 range 3968..3999; Associated at 0 range 4024..4031; end record; type Fortran_LOS_Array_type is array ( GD.Int range <> ) of Fortran_LOS_Vector_Access_type; type Fortran_LOS_Array_Access_type is access Fortran_LOS_Array_type; type Fortran_MDP_OSM_Type; type Fortran_MDP_OSM_Access_Type is access Fortran_MDP_OSM_Type; type Fortran_MDP_OSM_Type is record Epoch : GD.Epoch_Time_Type := 0.0; Platform_State : OD.State_ECI_Type := (others => (others => 0.0)); Boresight : VEC.Vector(1..3) := (others => 0.0); Unit_LOS : OD.Unit_LOS_Type := (others => 0.0); Unit_LOS_Rate : OD.Unit_LOS_Type := (others => 0.0); Unit_LOS_Accel : OD.Unit_LOS_Type := (others => 0.0); Intensity : GD.Real := 0.0; Second_Moments_ECI : VEC.Vector(1..3) := (others => 0.0); AMA_ECI : VEC.Vector(1..3); RMA : GD.Real; Truth : Fortran_Truth_Type; Platform_ID : GD.Platform_ID_Type := 1; Mono_ID : GD.Mono_ID_Type := 0; Parent_ID : GD.Mono_ID_Type := 0; Stereo_ID : GD.Stereo_ID_Type := 0; Sensor : GD.Int := 0; Sensor_Band : GD.Int := 0; Detection_ID : GD.Int := 0; OSM_Type : GD.Int := 0; Object : GD.Int := 0; Phase : GD.Int := 0; Track_Status : GD.Int := 0; Mono_Status : GD.Int := 0; Mono_Type : GD.Int := 0; end record; for Fortran_MDP_OSM_Type use record Epoch at 0 range 0..63; Platform_State at 0 range 64..639; Boresight at 0 range 640..831; Unit_LOS at 0 range 832..1023; Unit_LOS_Rate at 0 range 1024..1215; Unit_LOS_Accel at 0 range 1216..1407; Intensity at 0 range 1408..1471; Second_Moments_ECI at 0 range 1472..1663; AMA_ECI at 0 range 1664..1855; RMA at 0 range 1856..1919; Truth at 0 range 1920..2911; -- Fortran seems to allign this next field on an 8 byte boundary Platform_ID at 0 range 2944..2975; Mono_ID at 0 range 2976..3007; Parent_ID at 0 range 3008..3039; Stereo_ID at 0 range 3040..3071; Sensor at 0 range 3072..3103; Sensor_Band at 0 range 3104..3135; Detection_ID at 0 range 3136..3167; OSM_Type at 0 range 3168..3199; Object at 0 range 3200..3231; Phase at 0 range 3232..3263; Track_Status at 0 range 3264..3295; Mono_Status at 0 range 3296..3327; Mono_Type at 0 range 3328..3359; end record; type Mono_State_Type is --Doug record --Doug Epoch : GD.Real; --Doug initialization_epoch : GD.Real; --Doug u_state : VEC.Vector(1..3); --Doug v_state : VEC.Vector(1..3); --Doug Mono_ID : GD.Int; --Doug Parent_ID : GD.Int; --Doug num_misses : GD.Int; --Doug end record; --Doug for Mono_State_Type use record --Doug Epoch at 0 range 0..63; --Doug initialization_epoch at 0 range 64..127; --Doug u_state at 0 range 128..319; --Doug v_state at 0 range 320..511; --Doug Mono_ID at 0 range 512..543; --Doug Parent_ID at 0 range 544..575; --Doug num_misses at 0 range 576..607; --Doug end record; --Doug -- types needed for the stereo to mono feed back subtype MAX_STEREO_PTR is GD.Int range 1..1000; --We are limited to 1000 stereo tracks for now type STEREO_LIST_TYPE is array (MAX_STEREO_PTR) of GD.Int; type Fortran_Stereo_IDs is record NUM_STEREO_TRACKS : GD.Int; STEREO_ID : STEREO_LIST_TYPE; end record; for Fortran_Stereo_IDs use record NUM_STEREO_TRACKS at 0 range 0..31; STEREO_ID at 0 range 32..32031; end record; type MONO_TAG_STRUCT is record PLATFORM_ID : GD.Int; MONO_ID : GD.Int; end record; for MONO_TAG_STRUCT use record PLATFORM_ID at 0 range 0..31; MONO_ID at 0 range 32..63; end record; subtype MAX_VIEWS is GD.Int range 1..40; type MONO_LIST_TYPE is array (MAX_VIEWS) of MONO_TAG_STRUCT; type STEREO_COMPONENTS_STRUCT is record STEREO_ID : GD.Int; NUM_MONOS : GD.Int; MONO_TAG : MONO_LIST_TYPE; end record; for STEREO_COMPONENTS_STRUCT use record STEREO_ID at 0 range 0..31; NUM_MONOS at 0 range 32..63; MONO_TAG at 0 range 64..2623; end record; type STEREO_STATE_COV_STRUCT is record POSITION : VEC.Vector(1..3); VELOCITY : VEC.Vector(1..3); ACCELERATION : VEC.Vector(1..3); COV : VEC.Vector(1..45); --triangular form of 9 by 9 LAST_UPDATE_TIME : GD.Real; Stereo_ChiSq : GD.Real; IMM_Filter_Used : GD.Int; STEREO_ID : GD.Int; end record; for STEREO_STATE_COV_STRUCT use record POSITION at 0 range 0..191; VELOCITY at 0 range 192..383; ACCELERATION at 0 range 384..575; COV at 0 range 576..3455; --triangular form of 9 by 9 LAST_UPDATE_TIME at 0 range 3456..3519; Stereo_ChiSq at 0 range 3520..3583; IMM_Filter_Used at 0 range 3584..3615; STEREO_ID at 0 range 3616..3647; end record; type Max_Establish_Track is range 1 .. 1200; type Mono_State_Array_type is --Doug array (Max_Establish_Track) of Mono_State_Type; --Doug -- Binding code for calling Fortran routines procedure TREX_READ_INIT_PARS; pragma INTERFACE (FORTRAN, TREX_READ_INIT_PARS); pragma IMPORT_PROCEDURE ( INTERNAL => TREX_READ_INIT_PARS, EXTERNAL => "trex_read_init_pars_" ); procedure TRTT_SGEN(SR_DX :GD.Int); pragma INTERFACE (FORTRAN, TRTT_SGEN); pragma IMPORT_PROCEDURE ( INTERNAL => TRTT_SGEN, EXTERNAL => "trtt_sgen_", PARAMETER_TYPES => (GD.Int), MECHANISM => (REFERENCE) ); procedure TRCA_SETUP_CAND_TRKS; pragma INTERFACE (FORTRAN, TRCA_SETUP_CAND_TRKS); pragma IMPORT_PROCEDURE ( INTERNAL => TRCA_SETUP_CAND_TRKS, EXTERNAL => "trca_setup_cand_trks_" ); procedure TRET_SETUP_ESTAB_TRKS; pragma INTERFACE (FORTRAN, TRET_SETUP_ESTAB_TRKS); pragma IMPORT_PROCEDURE ( INTERNAL => TRET_SETUP_ESTAB_TRKS, EXTERNAL => "tret_setup_estab_trks_" ); procedure TRET_ESTAB_TRKR(SR_DX :GD.Int; NUM_ACTIVE :in out GD.Int); pragma INTERFACE (FORTRAN, TRET_ESTAB_TRKR); pragma IMPORT_PROCEDURE ( INTERNAL => TRET_ESTAB_TRKR, EXTERNAL => "tret_estab_trkr_", PARAMETER_TYPES => (GD.Int,GD.Int), MECHANISM => (REFERENCE,REFERENCE) ); procedure TRCA_CAND_TRKR(SR_DX :GD.Int); pragma INTERFACE (FORTRAN, TRCA_CAND_TRKR); pragma IMPORT_PROCEDURE ( INTERNAL => TRCA_CAND_TRKR, EXTERNAL => "trca_cand_trkr_", PARAMETER_TYPES => (GD.Int), MECHANISM => (REFERENCE) ); procedure TRCA_CAND_INIT(SR_DX :GD.Int); pragma INTERFACE (FORTRAN, TRCA_CAND_INIT); pragma IMPORT_PROCEDURE ( INTERNAL => TRCA_CAND_INIT, EXTERNAL => "trca_cand_init_", PARAMETER_TYPES => (GD.Int), MECHANISM => (REFERENCE) ); procedure TRWD_WEED_CAND(SR_DX :GD.Int; NUM_NEW_OSMS :in out GD.Int; NUM_CURRENT :in out GD.Int ); pragma INTERFACE (FORTRAN, TRWD_WEED_CAND); pragma IMPORT_PROCEDURE ( INTERNAL => TRWD_WEED_CAND, EXTERNAL => "trwd_weed_cand_", PARAMETER_TYPES => (GD.Int, GD.Int, GD.Int), MECHANISM => (REFERENCE,REFERENCE,REFERENCE) ); procedure CLEANUP(SR_DX :GD.Int); pragma INTERFACE (FORTRAN, CLEANUP); pragma IMPORT_PROCEDURE ( INTERNAL => CLEANUP, EXTERNAL => "cleanup_", PARAMETER_TYPES => (GD.Int), MECHANISM => (REFERENCE) ); procedure StoreScanHeader (SR_DX:in out GD.Int; HEADER : LOS_Vectors.Sensor_Header_type); procedure Fortran_StoreScanHeader (SR_DX:in out GD.Int; HEADER : Fortran_Sensor_Header_type); pragma INTERFACE (FORTRAN, Fortran_StoreScanHeader); pragma IMPORT_PROCEDURE ( INTERNAL => Fortran_StoreScanHeader, EXTERNAL => "store_scan_header_", PARAMETER_TYPES => (GD.Int,Fortran_Sensor_Header_type), MECHANISM => (REFERENCE,REFERENCE) ); procedure StoreOneLOS (LOS : LOS_Vectors.LOS_Vector_type); procedure Fortran_StoreOneLOS (LOS : Fortran_LOS_Vector_type); pragma INTERFACE (FORTRAN, Fortran_StoreOneLOS); pragma IMPORT_PROCEDURE ( INTERNAL => Fortran_StoreOneLOS, EXTERNAL => "store_one_los_", PARAMETER_TYPES => (Fortran_LOS_Vector_type), MECHANISM => (REFERENCE) ); procedure SortScanData(SR_DX : GD.Int); pragma INTERFACE (FORTRAN, SortScanData); pragma IMPORT_PROCEDURE ( INTERNAL => SortScanData, EXTERNAL => "sort_scan_data_", PARAMETER_TYPES => (GD.Int), MECHANISM => (REFERENCE) ); procedure LoadOSM(I :GD.Int; osm : out OD.MDP_OSM_Type); procedure Fortran_LoadOSM(I :GD.Int; osm :out Fortran_MDP_OSM_Type); pragma INTERFACE (FORTRAN, Fortran_LoadOSM); pragma IMPORT_PROCEDURE ( INTERNAL => Fortran_LoadOSM, EXTERNAL => "load_osm_", PARAMETER_TYPES => (GD.Int, Fortran_MDP_OSM_Type), MECHANISM => (REFERENCE,REFERENCE) ); procedure LoadMonoStates(SR_DX : in GD.Int; num_current : in GD.Int; mono_states :out Mono_State_Array_type ); pragma INTERFACE (FORTRAN, LoadMonoStates); pragma IMPORT_PROCEDURE ( INTERNAL => LoadMonoStates, EXTERNAL => "load_mono_states_", PARAMETER_TYPES => ( GD.Int, GD.Int, Mono_State_Array_type), MECHANISM => (REFERENCE,REFERENCE,REFERENCE) ); procedure RELEASE_TRACK_POINTS(SR_DX : GD.Int); pragma INTERFACE (FORTRAN, RELEASE_TRACK_POINTS); pragma IMPORT_PROCEDURE ( INTERNAL => RELEASE_TRACK_POINTS, EXTERNAL => "release_track_points_", PARAMETER_TYPES => (GD.Int), MECHANISM => (REFERENCE) ); procedure TERMINATE_TRACKS(SR_DX : GD.Int); pragma INTERFACE (FORTRAN, TERMINATE_TRACKS); pragma IMPORT_PROCEDURE ( INTERNAL => TERMINATE_TRACKS, EXTERNAL => "terminate_tracks_", PARAMETER_TYPES => (GD.Int), MECHANISM => (REFERENCE) ); -- Routines to implement the Stereo to Mono feedback procedure SetActiveStereoTracks(SR_DX:GD.Int; STEREO_IDS : in Fortran_Stereo_IDs); pragma INTERFACE (FORTRAN, SetActiveStereoTracks); pragma IMPORT_PROCEDURE ( INTERNAL => SetActiveStereoTracks, EXTERNAL => "setactivestereotracks_", PARAMETER_TYPES => (GD.Int,Fortran_Stereo_IDs), MECHANISM => (REFERENCE,REFERENCE) ); procedure UpdateStereoComponents(STEREO_COMPONENTS : in STEREO_COMPONENTS_STRUCT); pragma INTERFACE (FORTRAN, UpdateStereoComponents); pragma IMPORT_PROCEDURE ( INTERNAL => UpdateStereoComponents, EXTERNAL => "updatestereocomponents_", PARAMETER_TYPES => (STEREO_COMPONENTS_STRUCT), MECHANISM => (REFERENCE) ); procedure SetStereoState(STEREO_STATE : in STEREO_STATE_COV_STRUCT); pragma INTERFACE (FORTRAN, SetStereoState); pragma IMPORT_PROCEDURE ( INTERNAL => SetStereoState, EXTERNAL => "setstereostate_", PARAMETER_TYPES => (STEREO_STATE_COV_STRUCT), MECHANISM => (REFERENCE) ); procedure INIT_STEREO_FB_INC; pragma INTERFACE (FORTRAN, INIT_STEREO_FB_INC); pragma IMPORT_PROCEDURE ( INTERNAL => INIT_STEREO_FB_INC, EXTERNAL => "init_stereo_fb_inc_" ); end Fortran_Interface; _______________________________________________ cheers..bob Guy Calinsky wrote in message news:375ECA88.CF7CFF7E@sll.northrop.com... > I have a subroutine written in FORTRAN that I need to link with my Ada > 83 code, but I am getting an Undefined Symbol error on that subroutine. > I followed the pragma example in the LRM (13.9). > Here is a small app I created to test the concept: > ---------------------- > > with Text_io; use Text_io; > with Long_Float_io; use Long_Float_io; > > procedure Ada_Main is > > procedure root(A : Long_Float; B : Long_Float; C : Long_Float; Result > : out Long_Float); > pragma Interface(Fortran, root); > > result : Long_Float; > > begin > > root(1.0, 2.0, 1.0, result); > put("result = "); put(result); new_line; > > end Ada_Main; > ---------------------- > > My FORTRAN subroutine : > subroutine root(a, b, c, x) > implicit none > real a, b, c, x > x = SQRT(b**2 - 4.0 * a * c) / (2.0 * a) > return > end > ---------------------- > > My Make script : > f77 -Xlist -g -C root.for > ada ada_main.a > a.ld -o ada_fortran_test ada_main root.o > ---------------------- > > Everything compiles ok and root.o does exist, yet I get this result : > Undefined first referenced > symbol in file > root > /home/calinsky/Fortran_Ada_Test/.objects/ada_main01 > ld: fatal: Symbol referencing errors. No output written to > ada_fortran_test > > > Any thoughts or ideas? > Thanks, > Guy >