コンパイルとリンク
2014-10-01


これまでに、copy.for,getc2.for,put2.forが出てきて、copyを実行させるパーツがそろったので、 実際に、作成し実行してみます。

ソースファイルなどを格納するフォルダーは下記の通りです。

最初に、Watcom Fortran77用の バッチファイルを作成しておきましょう。まずは、コンパイル用。fc.bat

@echo off
rem fc.for
wfc386 ..\src\%1.for
move ..\bat\%1.obj ..\obj

リンケージ用。fl.bat

@echo off
rem fl.bat
wlink file ..\obj\%1.obj lib ..\obj\ratfor.lib
move ..\obj\%1.exe ..\exe

オブジェクト・プログラム・ライブラリーのメンテナンス用。fo.bat

@echo off
rem fo.bat 
wlib ..\obj\ratfor.lib -+..\obj\%1.obj

早速コンパイルしてみましょう。コマンド・プロンプトをあけて、 バッチファイルのあるディレクトリに移動して、 コンパイルします。

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\Hiroya>cd Documents\ratfor\fortran\bat

C:\Users\Hiroya\Documents\ratfor\fortran\bat>fc getc2
Open Watcom FORTRAN 77/32 Optimizing Compiler Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
..\src\getc2.for: 27 ステートメント, 166 バイト, 6 拡張メッセージ, 0 警告エラー, 0 エラー
        1 個のファイルを移動しました。

getc2.objをratfor.libに登録します。

C:\Users\Hiroya\Documents\ratfor\fortran\bat>fo getc2
Open Watcom Library Manager Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
Warning! '..\obj\ratfor.lib'をオープンできません - ライブラリを作成します

C:\Users\Hiroya\Documents\ratfor\fortran\bat>

同様にputc2をコンパイルしratfor.libに登録します。

C:\Users\Hiroya\Documents\ratfor\fortran\bat>fc putc2
Open Watcom FORTRAN 77/32 Optimizing Compiler Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
..\src\putc2.for: 16 ステートメント, 113 バイト, 4 拡張メッセージ, 0 警告エラー, 0 エラー
        1 個のファイルを移動しました。

C:\Users\Hiroya\Documents\ratfor\fortran\bat>fo putc2
Open Watcom Library Manager Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.

C:\Users\Hiroya\Documents\ratfor\fortran\bat>

copyをコンパイルし、ライブラリーとリンクします。

C:\Users\Hiroya\Documents\ratfor\fortran\bat>fc copy
Open Watcom FORTRAN 77/32 Optimizing Compiler Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
..\src\copy.for: 8 ステートメント, 35 バイト, 5 拡張メッセージ, 0 警告エラー, 0 エラー
        1 個のファイルを移動しました。

C:\Users\Hiroya\Documents\ratfor\fortran\bat>fl copy
Open Watcom Linker Version 1.9
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
オブジェクトファイルを読込み中
ライブラリを検索中
a Windows NT character-mode 実行可能 を作成中
        1 個のファイルを移動しました。

C:\Users\Hiroya\Documents\ratfor\fortran\bat>

テストします。



続きを読む

[コンピューター]
[RATFOR]

コメント(全50件)
※コメントの受付件数を超えているため、この記事にコメントすることができません。


記事を書く
powered by ASAHIネット