JP2004185472A - Dynamic link system, method and program for controlling dynamic link - Google Patents

Dynamic link system, method and program for controlling dynamic link Download PDF

Info

Publication number
JP2004185472A
JP2004185472A JP2002353534A JP2002353534A JP2004185472A JP 2004185472 A JP2004185472 A JP 2004185472A JP 2002353534 A JP2002353534 A JP 2002353534A JP 2002353534 A JP2002353534 A JP 2002353534A JP 2004185472 A JP2004185472 A JP 2004185472A
Authority
JP
Japan
Prior art keywords
program
dynamic link
storage space
address
generated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2002353534A
Other languages
Japanese (ja)
Other versions
JP3918096B2 (en
Inventor
Hisao Kurosawa
尚生 黒澤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP2002353534A priority Critical patent/JP3918096B2/en
Publication of JP2004185472A publication Critical patent/JP2004185472A/en
Application granted granted Critical
Publication of JP3918096B2 publication Critical patent/JP3918096B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a dynamic link system capable of suitably accessing an external module in an electronic computer system. <P>SOLUTION: When an address constant (b) of a program 21 is unsolved, a program loading part 11 generates a program 22 and sets the address of dynamic link information T in an address constant (t). Then the format of the address constant (b) of the program 21 is converted and a start address of the program 22 is set. When the execution of the program 21 is started and a CALL instruction (a) is executed, the program 21 is shifted to the program 22 and the CALL instruction (b) is executed. Control is transferred to a dynamic link part 12 by the execution of the CALL instruction (b) and a program 23 is loaded. The dynamic link part 12 sets the start address of the program 23 in a variable En and returns the variable En to the program 22. When a CALL instruction (c) is executed by the program 22, the execution of the program 23 is started. <P>COPYRIGHT: (C)2004,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
この発明は、電子計算機システムにおいて、外部モジュール(外部プログラム)を適切に呼び出すことのできる動的リンク方式、動的リンク制御方法およびプログラムに関する。
【0002】
【従来の技術】
従来より、電子計算機システムにおいて動的リンク方式が用いられている。この動的リンク方式は、リンク時にプログラムと外部モジュール(ライブラリ等の外部プログラム)とを結合するのではなく、プログラムの実行時に、必要に応じて外部モジュールを呼び出す手法である。
【0003】
具体的に図6及び図7を参照して動的リンク方式について説明する。なお、図6において、プログラム201は、実行対象となるプログラムであり、外部モジュールとなるプログラム202を呼ぶために、アドレス定数bを含んでいる。このアドレス定数bは、図7に示すように、フラグFと、アドレスAdとからなる。
フラグFは、リンク解決済み若しくはリンク未解決を示すフラグである(なお、プログラム201の実行開始前には、リンク未解決となっている)。
また、アドレスAdは、呼び出し対象のプログラムまたはデータの記憶空間上のアドレス(位置)を示している。
【0004】
図6(a)に示すように、まず、プログラムロード部101は、プログラム201を所定の補助記憶装置(ハードディスク等)から記憶空間へロードする。そして、プログラム201が実行されて処理が進み、CALL命令aが実行されると、アドレス定数bのフラグFがリンク未解決となっているため、図6(b)に示すように、動的リンク要求を示す例外(ソフトウェア割込み)が発生し、動的リンク部102に制御が移る。
動的リンク部102は、動的リンク情報Tを参照してプログラム202を補助記憶装置から記憶空間へロードし、アドレス定数bのアドレスAdにプログラム202の実行開始アドレスを設定する。そして、アドレス定数bのフラグFをリンク解決済みに変更する。
その後、図6(c)に示すように、プログラム201に制御が戻り、CALL命令aが再実行されると、アドレス定数bのアドレスAdに従って、動的リンク対象となるプログラム202の実行が開始される。
【0005】
また、このような動的リンク方式において、プログラムの実行速度、及び、リンク速度を向上させる技術も開示されている(例えば、特許文献1参照)。
【0006】
【特許文献1】
特開平5−53827号公報 (第3−5頁、第1図)
【0007】
【発明が解決しようとする課題】
しかしながら、従来の動的リンク方式には、次のような問題点があった。
まず、第1の問題点は、記憶空間自体の大きさが制限されてしまうことである。これは、図7に示したように、リンク解決済み/未解決を示すフラグFがアドレス定数b内に必要となるため、その分だけアドレスAdのビット数が小さくなることに起因する。
例えば、アドレス定数bが32ビット長である場合、本来であれば32ビット全てを使用して、記憶空間を指し示すことができる。しかし、フラグFに1ビットを使用してしまうため、記憶空間は残りの31ビットで指し示すことになる。このため、記憶空間の大きさが本来の2分の1に制限されてしまう。
【0008】
第2の問題点は、プログラムが複数のタスク間で共有されることを考慮し、同期をとる仕組みを組み込む必要があるため、プログラム作成の難易度が高くなってしまうことである。
例えば、プログラム201、プログラム202の両方が複数のタスク間で共有されていた場合に、プログラム201から、プログラム202を動的リンクするためには、プログラム201にタスク間で同期をとる仕組みを組み込まなければならない。
これは、同期をとる仕組みがないと、あるタスクでアドレス定数bを書き換え、全く同一時刻に別のタスクでアドレス定数bを参照した場合に、アドレス定数bが書き換え中の中間状態となってしまい、正常に動作できないためである。
【0009】
第3の問題点は、動的リンクが不可能となる場合が生じてしまうことである。
例えば、プログラム201を複数のタスク間で共有し、プログラム202を共有しない場合、プログラム201からプログラム202への動的リンクが不可能となってしまう。
これは、プログラム202がタスク間で共有されていないと、一般にプログラム202の実行開始アドレスがタスク毎に異なる。それでも、プログラム202の実行開始アドレスを設定すべきアドレス定数bがタスク間で共有されていると、実行開始アドレスを1つしか設定できないため、プログラム202への動的リンクが不可能となる事態が生じてしまう。
【0010】
また、上述の特開平5−53827号公報に開示された動的リンク方式では、呼び出し元のプログラム(ロードモジュール)に、コンパイラやスタティックリンカが、NOP命令や直接呼び出し命令等を埋め込む必要があった。そのため、ロードモジュールの互換性が保てない等の問題があった。
【0011】
この発明は、上記実状に鑑みてなされたもので、電子計算機システムにおいて、外部モジュール(外部プログラム)を適切に呼び出すことのできる動的リンク方式、動的リンク制御方法およびプログラムを提供することを目的とする。
【0012】
【課題を解決するための手段】
上記目的を達成するため、本発明の第1の観点に係る動的リンク方式は、
電子計算機システムにおいて、第1のプログラムから第2のプログラムを動的にリンクして実行させる動的リンク方式であって、
第1のプログラムを記憶空間にロードし、
第1のプログラムから第2のプログラムへの呼び出しを仲介する第3のプログラムを記憶空間に生成し、
記憶空間にロードされた第1のプログラムの呼び出し対象を、生成された第3のプログラムに変更し、
呼び出し対象が変更された第1のプログラムの実行に伴い、生成された第3のプログラムを実行させ、
呼び出し対象の第2のプログラムを記憶空間にロードし、
ロードされた第2のプログラムの開始アドレスを、生成された第3のプログラムに設定し、
開始アドレスが設定された第3のプログラムの実行に伴い、呼び出された第2のプログラムを実行させる、
ことを特徴とする。
【0013】
この発明によれば、第1のプログラムがロードされた際に、第3のプログラムが生成される。そして、第1のプログラムから第3のプログラムを仲介して第2のプログラムが呼び出される。この結果、電子計算機システムにおいて、外部モジュール(外部プログラム)を適切に呼び出すことができる。
【0014】
上記目的を達成するため、本発明の第2の観点に係る動的リンク方式は、
電子計算機システムにおいて、第1のプログラムから第2のプログラムを動的にリンクして実行させる動的リンク方式であって、
第1のプログラムを記憶空間にロードした際に、第1のプログラムから第2のプログラムへの呼び出しを仲介する第3のプログラムを記憶空間に生成すると共に、記憶空間にロードした第1のプログラムの呼び出し対象を、生成した第3のプログラムに変更するプログラムロード手段と、
呼び出し対象が変更された第1のプログラムが実行され、生成された第3のプログラムが実行した際に、第2のプログラムを記憶空間にロードすると共に、ロードした第2のプログラムの開始アドレスを、生成された第3のプログラムに設定して、第3のプログラムから呼び出された第2のプログラムを実行する動的リンク手段と、
を備えることを特徴とする。
【0015】
この発明によれば、プログラムロード手段は、第1のプログラムをロードした際に、第3のプログラムを生成する。そして、動的リンク手段は、第3のプログラムを仲介して、第2のプログラムを実行する。この結果、電子計算機システムにおいて、外部モジュール(外部プログラム)を適切に呼び出すことができる。
【0016】
上記目的を達成するため、本発明の第3の観点に係る動的リンク方式は、
動的リンクの対象を示す動的リンク情報と、動的リンクが未解決であるか否かを示すフラグ及び、呼び出し対象のアドレスからなるアドレス定数と、を含む第1のプログラムから第2のプログラムを動的にリンクして実行させる動的リンク方式であって、
第1のプログラムを記憶空間にロードした際に、フラグを含まないアドレス定数及び、呼び出し命令を含んだ第3のプログラムを記憶空間に生成する生成手段と、
生成された第3のプログラムのアドレス定数に動的リンク情報のアドレスをセットするセット手段と、
記憶空間にロードされた第1のプログラムのアドレス定数を、フラグを排除し、生成された第3のプログラムのアドレスに変更する変更手段と、
アドレス定数が変更された第1のプログラムが実行され、生成された第3のプログラムが実行した際に、第1のプログラムの動的リンク情報に従って、第2のプログラムを記憶空間にロードするロード手段と、
ロードされた第2のプログラムの開始アドレスを、生成された第3のプログラムの呼び出し命令に設定する設定手段と、
開始アドレスが設定された呼び出し命令の実行により、呼び出された第2のプログラムを実行するリンク手段と、
を備えることを特徴とする。
【0017】
この発明によれば、生成手段は、第1のプログラムをロードした際に、第3のプログラムを生成する。そして、リンク手段は、第3のプログラムを仲介して第2のプログラムを実行する。この結果、電子計算機システムにおいて、外部モジュール(外部プログラム)を適切に呼び出すことができる。
【0018】
上記の動的リンク方式は、プログラムからプログラムへの呼び出しを仲介する雛形プログラムを更に備え、
前記生成手段は、前記雛形プログラムに従って、第3のプログラムを記憶空間に生成してもよい。
【0019】
上記目的を達成するため、本発明の第4の観点に係る動的リンク制御方法は、
電子計算機システムにおいて、第1のプログラムから第2のプログラムを動的にリンクして実行させる動的リンク制御方法であって、
第1のプログラムを記憶空間にロードするステップと、
第1のプログラムから第2のプログラムへの呼び出しを仲介する第3のプログラムを記憶空間に生成するステップと、
記憶空間にロードされた第1のプログラムの呼び出し対象を、生成された第3のプログラムに変更するステップと、
呼び出し対象が変更された第1のプログラムの実行に伴い、生成された第3のプログラムを実行させるステップと、
呼び出し対象の第2のプログラムを記憶空間にロードするステップと、
ロードされた第2のプログラムの開始アドレスを、生成された第3のプログラムに設定するステップと、
開始アドレスが設定された第3のプログラムの実行に伴い、呼び出された第2のプログラムを実行させるステップと、
を備えることを特徴とする。
【0020】
この発明によれば、第1のプログラムがロードされた際に、第3のプログラムが生成される。そして、第1のプログラムから第3のプログラムを仲介して第2のプログラムが呼び出される。この結果、電子計算機システムにおいて、外部モジュール(外部プログラム)を適切に呼び出すことができる。
【0021】
上記目的を達成するため、本発明の第5の観点に係る動的リンク制御方法は、
動的リンクの対象を示す動的リンク情報と、動的リンクが未解決であるか否かを示すフラグ及び、呼び出し対象のアドレスからなるアドレス定数と、を含む第1のプログラムから第2のプログラムを動的にリンクして実行させる動的リンク制御方法であって、
第1のプログラムを記憶空間にロードした際に、フラグを含まないアドレス定数及び、呼び出し命令を含んだ第3のプログラムを記憶空間に生成する生成ステップと、
生成された第3のプログラムのアドレス定数に動的リンク情報のアドレスをセットするセットステップと、
記憶空間にロードされた第1のプログラムのアドレス定数を、フラグを排除し、生成された第3のプログラムのアドレスに変更する変更ステップと、
アドレス定数が変更された第1のプログラムが実行され、生成された第3のプログラムが実行した際に、第1のプログラムの動的リンク情報に従って、第2のプログラムを記憶空間にロードするロードステップと、
ロードされた第2のプログラムの開始アドレスを、生成された第3のプログラムの呼び出し命令に設定する設定ステップと、
開始アドレスが設定された呼び出し命令の実行により、呼び出された第2のプログラムを実行するリンクステップと、
を備えることを特徴とする。
【0022】
この発明によれば、生成ステップは、第1のプログラムをロードした際に、第3のプログラムを生成する。そして、リンクステップは、第3のプログラムを仲介して第2のプログラムを実行する。この結果、電子計算機システムにおいて、外部モジュール(外部プログラム)を適切に呼び出すことができる。
【0023】
上記目的を達成するため、本発明の第6の観点に係るプログラムは、
コンピュータに、
第1のプログラムを補助記憶装置から記憶空間にロードするステップと、第1のプログラムから第2のプログラムへの呼び出しを仲介する第3のプログラムを記憶空間に生成するステップと、記憶空間にロードされた第1のプログラムの呼び出し対象を、生成された第3のプログラムに変更するステップと、呼び出し対象が変更された第1のプログラムの実行に伴い、生成された第3のプログラムを演算処理部に実行させるステップと、呼び出し対象の第2のプログラムを補助記憶装置から記憶空間にロードするステップと、ロードされた第2のプログラムの開始アドレスを、生成された第3のプログラムに設定するステップと、開始アドレスが設定された第3のプログラムの実行に伴い、呼び出された第2のプログラムを演算処理部に実行させるステップと、
を実行させることを特徴とする。
【0024】
【発明の実施の形態】
本発明の実施の形態にかかる動的リンク方式について、以下図面を参照して説明する。
【0025】
図1は、この発明の実施の形態に適用される動的リンク方式の構成の一例を示すブロック図である。なお、この動的リンク方式は、所定のハードウェア(CPU、メモリ、及び、ハードディスク等)を備えた電子計算機システムにて実現され、プログラムロード部11と、動的リンク部12と、プログラム21と、プログラム22と、プログラム23と、を含んで構成される。
【0026】
プログラムロード部11は、例えば、システムプログラム等からなり、補助記憶装置(ハードディスク等)に記憶されている実行対象となるプログラム21等を、記憶空間(メモリ等)にロードする。
このプログラム21は、電子計算機システムにてメインに実行されるユーザプログラム(又は、アプリケーションプログラム)等であり、プログラム23を動的リンクの対象としている。そして、記憶空間にロードされ、演算処理部(CPU等)にて実行が開始されると、プログラム22を介して外部モジュールとなるプログラム23を呼び出す。
【0027】
具体的にプログラム21には、動的リンク情報T、アドレス定数b、及び、CALL命令aが含まれている。
動的リンク情報Tは、動的リンクの対象となるプログラム23を示す情報(例えば、プログラム名)からなる。
【0028】
アドレス定数bは、初期状態(プログラム21の実行開始前)において、図2(a)に示すように、フラグFと、アドレスAd0とからなる。
フラグFは、リンク解決済み若しくはリンク未解決を示すフラグである(なお、初期状態において、リンク未解決となっている)。また、アドレスAd0は、呼び出し対象のプログラムまたはデータの記憶空間上のアドレス(位置)を示している。
なお、アドレス定数bは、プログラム21の実行時に、プログラムロード部11により、図2(b)に示す形式に変換される。
【0029】
CALL命令aは、初期状態において、アドレス定数bのアドレスAd0にて指定されたプログラムに制御を移す命令である。
【0030】
プログラム22は、プログラムロード部11により、記憶空間に生成され、プログラム21から外部モジュールのプログラム23を呼ぶ際に、仲介役を果たすプログラムである。
具体的にプログラム22には、アドレス定数t、CALL命令b、及び、CALL命令cが含まれている。
なお、プログラム22も演算処理部(CPU等)にて実行される。
【0031】
アドレス定数tは、図2(b)に示すように、上述の図2(a)と異なり、アドレスAd1だけからなる。そして、アドレスAd1は、動的リンク情報Tのアドレスを示している。
CALL命令bは、パラメータ(引数)にアドレス定数tと変数Enを指定し、動的リンク部12を呼び出す(制御を移す)命令である。
CALL命令cは、変数Enに設定されたアドレスのプログラムに制御を移す命令である。
【0032】
プログラム23は、プログラム21の動的リンクの対象となる外部モジュール(外部プログラム)であり、初期状態において、補助記憶装置に記憶されている。
なお、プログラム23も記憶空間にロードされ、演算処理部(CPU等)にて実行される。
【0033】
また、プログラムロード部11は、プログラム21の実行開始時に、アドレス定数bを更新する。具体的には、プログラムロード部11は、アドレス定数bを図2(b)に示す形式に変換する。そして、記憶空間にプログラム22を生成して、アドレスAd1にプログラム22の実行開始アドレスを設定する。
【0034】
動的リンク部12は、例えば、システムプログラム等からなり、上述のプログラム22に呼び出される。動的リンク部12は、プログラム21の動的リンク情報Tに従って、動的リンクの対象となるプログラム23を特定する。そして、特定したプログラム23を記憶空間に動的にロードし、プログラム23の実行開始アドレスを変数Enにセットして、プログラム22に返却する。
【0035】
以下、この発明の形態にかかる動的リンク方式の動作について、図3等を参照して説明する。
図3は、プログラムロード部11及び、動的リンク部12にて実行される動的リンク制御処理を説明するためのフローチャートである。この処理は、電子計算機システムにて、メインプログラムとなるプログラム21の実行が指示された後に開始される。
【0036】
まず、プログラムロード部11は、実行対象のプログラム21を記憶空間にロードする(ステップS11)。つまり、図4(a)に示すように、プログラムロード部11によりプログラム21が補助記憶装置から記憶空間にロードされる。
プログラムロード部11は、プログラム21に含まれるアドレス定数bを検索する(ステップS12)。
【0037】
プログラムロード部11は、検索したアドレス定数bにて、フラグFがリンク未解決となっているか否かを判別する(ステップS13)。つまり、図2(a)に示すようなアドレス定数bにおいてフラグFの値が、リンク未解決となっているか否かを判別する。
プログラムロード部11は、リンク未解決でない(リンク解決済み)であると判別すると、後述するステップS17に処理を進める。一方、フラグFがリンク未解決であると判別した場合に、プログラムロード部11は、プログラム22を記憶空間上に生成する(ステップS14)。つまり、図4(a)に示すように、プログラムロード部11によりプログラム22が記憶空間上に生成される。
【0038】
そして、プログラムロード部11は、生成したプログラム22のアドレス定数tに、動的リンク情報Tのアドレスを設定する。(ステップS15)、また、プログラムロード部11は、プログラム21のアドレス定数bを、図2(a)の形式から図2(b)の形式に変換し、アドレスAd1にプログラム22の実行開始アドレスをセットする(ステップS16)。
【0039】
プログラムロード部11は、ステップS12にて検索したアドレス定数bが、最後のアドレス定数であるか否かを判別する(ステップS17)。つまり、プログラム21中の全てのアドレス定数bに対して処理を行ったか否かを判別する。
プログラムロード部11は、最後のアドレス定数でないと判別すると、ステップS12に処理を戻し、上述のステップS12〜S17の処理を繰り返し実行する。一方、最後のアドレス定数であると判別した場合に、実行前の事前準備を終え、プログラム21の実行が開始される(ステップS18)。
【0040】
プログラム21の実行が開始され、CALL命令aが実行されると、この実行に伴い、プログラム22に制御が移る(ステップS19)。
これは、上述のステップS16にて、アドレス定数b(アドレスAd1)にプログラム22の実行開始アドレスがセットされているためである。つまり、図4(a)に示すように、CALL命令aが実行され、アドレス定数b(アドレスAd1)が参照され、プログラム22に制御が移る。
【0041】
プログラム22に制御が移り、最初にCALL命令bが実行されると、この実行に伴い、動的リンク部12に制御が移る(ステップS20)。つまり、図4(a)に示すように、CALL命令bにて、パラメータにアドレス定数tと変数Enを指定し、動的リンク部12が呼び出される。
【0042】
動的リンク部12は、動的リンクの対象となるプログラム23を記憶空間にロードする(ステップS21)。すなわち、動的リンク部12は、図4(b)に示すように、パラメータのアドレス定数tを参照して、動的リンク情報Tを取得すると、取得した動的リンク情報Tに従って、動的リンクの対象となるプログラム23を特定する。そして、このプログラム23を、補助記憶装置から記憶空間に動的にロードする。
動的リンク部12は、プログラム23の実行開始アドレスを変数Enに設定して、プログラム22に返却する(ステップS22)。つまり、プログラム23の実行開始アドレスを変数Enにセットして、プログラム22に制御を戻す。
【0043】
プログラム22に制御が戻り、続いてCALL命令cが実行されると、この実行に伴い、プログラム23の実行が開始される(ステップS23)。つまり、図4(c)に示すように、変数Enには、プログラム23の実行開始アドレスがセットされているため、プログラム23が呼び出され実行される。
【0044】
このように、動的リンク制御処理により、従来の動的リンク方式の課題を解決しつつ、外部モジュール(外部プログラム)を適切に呼び出すことができる。
すなわち、本発明の実施の形態にかかる動的リンク方式は、以下のような効果がある。
【0045】
まず、第1の効果は、記憶空間の大きさを広げることが可能となる。これは、プログラム21が実行される際に、アドレス定数bが、図2(a)の形式から図2(b)の形式に変換されるためである。つまり、プログラム21の開始時点で、図2(a)のフラグFが不要となり、アドレス定数bをアドレス設定だけに使用できることとなり、記憶空間の大きさを広げることできる(第1の問題点に対応)。
【0046】
第2の効果は、プログラム21及びプログラム23の両方が複数のタスク間で共有されていた場合であっても、アプリケーションプログラム側(プログラム21)に、タスク間で同期をとる仕組みを必要としないことである。これは、プログラム21の実行開始後には、アドレス定数bが動的に書き換えられることが無いためである。つまり、あるタスクでアドレス定数bを更新中に、他のタスクがアドレス定数bを参照することが無いため、プログラム21に、タスク間で同期をとる仕組みを必要としない(第2の問題点に対応)。
【0047】
第3の効果は、プログラム21を複数のタスク間で共有し、かつ、プログラム23をタスク間で共有しない場合であっても、プログラム21からプログラム23を動的リンクすることが可能となる。これは、仲介役となるプログラム22のアドレス定数tの位置がタスク毎に異なるためである。つまり、タスクによってプログラム23の実行開始アドレスが異なる場合であっても、そのアドレスをアドレス定数tに設定できるため、プログラム21からプログラム23を動的リンクすることができる(第3の問題点に対応)。
【0048】
更に、第4の効果は、本方式を採用するにあたり、プログラム21及びプログラム23を再作成、再コンパイル、若しくは、再リンクする必要がないことである。
【0049】
上記の実施の形態では、プログラムロード部11は、記憶空間に仲介役となるプログラム22を生成するが、このプログラム22の生成手法は任意である。
例えば、プログラムロード部11は、雛形となるプログラムに従って、プログラム22を生成してもよい。
以下、本発明の変形例について、図5を参照して簡単に説明する。図5は、この発明の他の実施の形態に適用される動的リンク方式の構成の一例を示すブロック図である。
【0050】
図示するように、この動的リンク方式は、プログラムロード部11と、動的リンク部12と、プログラム21と、プログラム22と、プログラム23と、雛形プログラム31と、を含んで構成される。
なお、プログラムロード部11〜プログラム23については、上述の図1に示す動的リンク方式の構成と同じである。
雛形プログラム31は、仮想空間内のシステムプログラム領域に配置され、プログラム22の雛形となる。
つまり、プログラムロード部11は、この雛形プログラム31を、記憶空間(ユーザプログラム実行領域等)にコピーすることにより、プログラム22を生成する。
【0051】
この動的リンク方式も、上述した図3の動的リンク制御処理にて動作することとなる。具体的な相違点は、プログラム22を生成する箇所(ステップS14)である。
すなわち、プログラム22を記憶空間上に生成するステップS14において、プログラムロード部11は、雛形プログラム31を、システムプログラム領域内からユーザプログラム実行領域にコピーすることにより、プログラム22を生成する。
【0052】
この図5に示す動的リンク方式によっても、従来の動的リンク方式の課題を解決しつつ、外部モジュール(外部プログラム)を適切に呼び出すことができる。
【0053】
なお、この発明の実施の形態にかかる動的リンク方式は、専用機器によらず、通常のコンピュータシステムを用いて実現可能である。例えば、コンピュータに上述のいずれかを実行するためのプログラムを格納した媒体(フレキシブルディスク、CD−ROM等)から当該プログラムをインストールすることにより、上述の処理を実行する動的リンク方式を構成することができる。
【0054】
また、コンピュータにプログラムを供給するための手法は、任意である。例えば、通信回線、通信ネットワーク、通信システム等を介して供給してもよい。一例を挙げると、通信ネットワークの掲示板(BBS)に当該プログラムを掲示し、これをネットワークを介して搬送波に重畳して配信する。
そして、このプログラムを起動し、OSの制御下で、他のアプリケーションプログラムと同様に実行することにより、上述の処理を実行することができる。
【0055】
【発明の効果】
以上説明したように、本発明によれば、電子計算機システムにおいて、外部モジュール(外部プログラム)を適切に呼び出すことができる。
【図面の簡単な説明】
【図1】本発明の実施の形態に係る動的リンク方式の構成の一例を示す模式図である。
【図2】実行対象のプログラムに含まれるアドレス定数の構造の一例を示す模式図であり、(a)が実行開始前のアドレス定数の図であり、(b)が実行開始後のアドレス定数の図である。
【図3】本発明の実施の形態に係る動的リンク制御処理を説明するためのフローチャートである。
【図4】(a)〜(c)共に、動的リンク方式の具体的動作を説明するための模式図である。
【図5】本発明の他の実施の形態に係る動的リンク方式の構成の一例を示す模式図である。
【図6】(a)〜(c)共に、従来の動的リンク方式の具体的動作を説明するための模式図である。
【図7】従来の実行対象のプログラムに含まれるアドレス定数の構造の一例を示す模式図である。
【符号の説明】
11 プログラムロード部
12 動的リンク部
21〜23 プログラム
31 雛形プログラム
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a dynamic link method, a dynamic link control method, and a program capable of appropriately calling an external module (external program) in an electronic computer system.
[0002]
[Prior art]
2. Description of the Related Art Conventionally, a dynamic link method has been used in an electronic computer system. This dynamic linking method is a method of calling an external module as needed at the time of execution of a program, instead of coupling a program and an external module (external program such as a library) at the time of linking.
[0003]
The dynamic link method will be specifically described with reference to FIGS. In FIG. 6, a program 201 is a program to be executed, and includes an address constant b to call a program 202 to be an external module. The address constant b includes a flag F and an address Ad, as shown in FIG.
The flag F is a flag indicating that the link has been resolved or the link has not been resolved (the link has not been resolved before the execution of the program 201 is started).
The address Ad indicates an address (position) in the storage space of the program or data to be called.
[0004]
As shown in FIG. 6A, first, the program loading unit 101 loads the program 201 from a predetermined auxiliary storage device (such as a hard disk) into a storage space. Then, when the program 201 is executed and the processing proceeds, and the CALL instruction a is executed, the flag F of the address constant b is unresolved, so that the dynamic link is executed as shown in FIG. An exception (software interrupt) indicating the request occurs, and control is transferred to the dynamic link unit 102.
The dynamic link unit 102 loads the program 202 from the auxiliary storage device into the storage space with reference to the dynamic link information T, and sets the execution start address of the program 202 in the address Ad of the address constant b. Then, the flag F of the address constant b is changed to the link resolved.
Thereafter, as shown in FIG. 6C, the control returns to the program 201, and when the CALL instruction a is re-executed, the execution of the program 202 to be dynamically linked starts according to the address Ad of the address constant b. You.
[0005]
In addition, in such a dynamic link method, a technique for improving a program execution speed and a link speed has been disclosed (for example, see Patent Document 1).
[0006]
[Patent Document 1]
JP-A-5-53827 (page 3-5, FIG. 1)
[0007]
[Problems to be solved by the invention]
However, the conventional dynamic link method has the following problems.
First, the first problem is that the size of the storage space itself is limited. This is because, as shown in FIG. 7, since the flag F indicating link resolved / unresolved is required in the address constant b, the number of bits of the address Ad is reduced accordingly.
For example, if the address constant b is 32 bits long, the storage space can be indicated using all 32 bits. However, since one bit is used for the flag F, the storage space is indicated by the remaining 31 bits. Therefore, the size of the storage space is limited to one half of the original size.
[0008]
The second problem is that it is necessary to incorporate a mechanism for synchronizing in consideration of the fact that the program is shared between a plurality of tasks, so that the difficulty in creating the program is increased.
For example, when both the program 201 and the program 202 are shared between a plurality of tasks, in order to dynamically link the program 202 from the program 201, a mechanism for synchronizing the tasks between the programs 201 must be incorporated. Must.
This is because if there is no synchronization mechanism, if a task rewrites the address constant b and another task refers to the address constant b at exactly the same time, the address constant b becomes an intermediate state during rewriting. This is because it cannot operate normally.
[0009]
A third problem is that dynamic linking may not be possible.
For example, when the program 201 is shared between a plurality of tasks and the program 202 is not shared, a dynamic link from the program 201 to the program 202 becomes impossible.
This is because when the program 202 is not shared between tasks, the execution start address of the program 202 generally differs for each task. Even so, if the address constant b for setting the execution start address of the program 202 is shared between the tasks, only one execution start address can be set, so that dynamic link to the program 202 becomes impossible. Will happen.
[0010]
In the dynamic link method disclosed in the above-mentioned Japanese Patent Application Laid-Open No. 5-53827, a compiler or a static linker needs to embed an NOP instruction, a direct call instruction, and the like in a caller program (load module). . Therefore, there is a problem that compatibility of the load module cannot be maintained.
[0011]
The present invention has been made in view of the above circumstances, and has as its object to provide a dynamic link method, a dynamic link control method, and a program capable of appropriately calling an external module (external program) in an electronic computer system. And
[0012]
[Means for Solving the Problems]
In order to achieve the above object, a dynamic link method according to a first aspect of the present invention includes:
In a computer system, a dynamic link system for dynamically linking and executing a second program from a first program,
Loading the first program into storage space,
Generating, in storage space, a third program that mediates a call from the first program to the second program;
Changing the call target of the first program loaded into the storage space to the generated third program;
With the execution of the first program whose call target has been changed, the generated third program is executed,
Load the second program to be called into the storage space,
Setting the start address of the loaded second program in the generated third program;
Causing the called second program to be executed with execution of the third program in which the start address is set;
It is characterized by the following.
[0013]
According to the present invention, when the first program is loaded, the third program is generated. Then, the second program is called from the first program via the third program. As a result, the external module (external program) can be appropriately called in the computer system.
[0014]
In order to achieve the above object, a dynamic link method according to a second aspect of the present invention includes:
In a computer system, a dynamic link system for dynamically linking and executing a second program from a first program,
When the first program is loaded into the storage space, a third program that mediates a call from the first program to the second program is generated in the storage space, and the third program that is loaded into the storage space is generated. Program loading means for changing the call target to the generated third program;
When the first program whose call target is changed is executed and the generated third program is executed, the second program is loaded into the storage space, and the start address of the loaded second program is set to Dynamic linking means for setting the generated third program and executing the second program called from the third program;
It is characterized by having.
[0015]
According to the present invention, the program loading means generates the third program when loading the first program. Then, the dynamic linking unit executes the second program via the third program. As a result, the external module (external program) can be appropriately called in the computer system.
[0016]
In order to achieve the above object, a dynamic link method according to a third aspect of the present invention includes:
A first program to a second program including dynamic link information indicating a target of a dynamic link, a flag indicating whether the dynamic link is unresolved, and an address constant including an address of a call target. Is a dynamic link method for dynamically linking and executing
Generating means for generating, in the storage space, an address constant not including a flag and a third program including a call instruction when the first program is loaded into the storage space;
Setting means for setting the address of the dynamic link information to the address constant of the generated third program;
Changing means for changing the address constant of the first program loaded into the storage space to an address of the generated third program, excluding the flag;
Loading means for loading the second program into the storage space according to the dynamic link information of the first program when the first program whose address constant has been changed is executed and the generated third program is executed When,
Setting means for setting the start address of the loaded second program in the generated call instruction of the third program;
Link means for executing the called second program by executing the call instruction in which the start address is set;
It is characterized by having.
[0017]
According to the present invention, the generation means generates the third program when the first program is loaded. Then, the link means executes the second program via the third program. As a result, the external module (external program) can be appropriately called in the computer system.
[0018]
The dynamic link method further includes a template program that mediates a call from the program to the program,
The generating means may generate a third program in a storage space according to the template program.
[0019]
In order to achieve the above object, a dynamic link control method according to a fourth aspect of the present invention comprises:
A dynamic link control method for dynamically linking and executing a second program from a first program in an electronic computer system,
Loading a first program into storage space;
Generating, in storage space, a third program that mediates a call from the first program to the second program;
Changing the call target of the first program loaded into the storage space to the generated third program;
Causing the generated third program to be executed with execution of the first program whose call target has been changed;
Loading a second program to be called into a storage space;
Setting the start address of the loaded second program in the generated third program;
Executing the called second program with execution of the third program in which the start address is set;
It is characterized by having.
[0020]
According to the present invention, when the first program is loaded, the third program is generated. Then, the second program is called from the first program via the third program. As a result, the external module (external program) can be appropriately called in the computer system.
[0021]
In order to achieve the above object, a dynamic link control method according to a fifth aspect of the present invention comprises:
A first program to a second program including dynamic link information indicating a target of a dynamic link, a flag indicating whether the dynamic link is unresolved, and an address constant including an address of a call target. Dynamic link control method for dynamically linking and executing
A generation step of generating, in the storage space, an address constant not including a flag and a third program including a call instruction when the first program is loaded into the storage space;
Setting an address of the dynamic link information to an address constant of the generated third program;
Changing the address constant of the first program loaded into the storage space to the address of the generated third program, excluding the flag;
A load step of loading the second program into the storage space according to the dynamic link information of the first program when the first program whose address constant has been changed is executed and the generated third program is executed When,
A setting step of setting a start address of the loaded second program to a generated call instruction of the third program;
A link step of executing the called second program by executing a call instruction in which a start address is set;
It is characterized by having.
[0022]
According to the present invention, the generating step generates the third program when the first program is loaded. Then, the link step executes the second program via the third program. As a result, the external module (external program) can be appropriately called in the computer system.
[0023]
In order to achieve the above object, a program according to a sixth aspect of the present invention includes:
On the computer,
Loading the first program from the auxiliary storage device into the storage space; generating a third program in the storage space that mediates a call from the first program to the second program; and loading the third program into the storage space. Changing the call target of the first program to the generated third program, and executing the generated third program to the arithmetic processing unit with the execution of the first program whose call target has been changed. Executing, loading the second program to be called from the auxiliary storage device into the storage space, and setting the start address of the loaded second program in the generated third program; The called second program is executed by the arithmetic processing unit with the execution of the third program in which the start address is set. And the step of,
Is executed.
[0024]
BEST MODE FOR CARRYING OUT THE INVENTION
A dynamic link system according to an embodiment of the present invention will be described below with reference to the drawings.
[0025]
FIG. 1 is a block diagram showing an example of a configuration of a dynamic link system applied to an embodiment of the present invention. This dynamic link method is realized by an electronic computer system provided with predetermined hardware (CPU, memory, hard disk, etc.), and includes a program load unit 11, a dynamic link unit 12, and a program 21. , A program 22, and a program 23.
[0026]
The program load unit 11 includes, for example, a system program and the like, and loads a program 21 and the like to be executed stored in an auxiliary storage device (such as a hard disk) into a storage space (memory or the like).
The program 21 is a user program (or an application program) or the like mainly executed in the computer system, and the program 23 is a target of the dynamic link. Then, when the program is loaded into the storage space and the execution is started by the arithmetic processing unit (CPU or the like), a program 23 which is an external module is called via the program 22.
[0027]
Specifically, the program 21 includes dynamic link information T, an address constant b, and a CALL instruction a.
The dynamic link information T includes information (for example, a program name) indicating the program 23 to be dynamically linked.
[0028]
The address constant b includes a flag F and an address Ad0 in an initial state (before the execution of the program 21 starts), as shown in FIG.
The flag F is a flag indicating that the link has been resolved or the link has not been resolved (the link is unresolved in the initial state). The address Ad0 indicates an address (position) in the storage space of the program or data to be called.
The address constant b is converted into the format shown in FIG. 2B by the program load unit 11 when the program 21 is executed.
[0029]
The CALL instruction a is an instruction for transferring control to the program specified by the address Ad0 of the address constant b in the initial state.
[0030]
The program 22 is a program generated in the storage space by the program load unit 11 and acting as an intermediary when the program 21 calls the program 23 of the external module.
Specifically, the program 22 includes an address constant t, a CALL instruction b, and a CALL instruction c.
Note that the program 22 is also executed by the arithmetic processing unit (CPU or the like).
[0031]
The address constant t, as shown in FIG. 2B, is different from the above-mentioned FIG. 2A and consists only of the address Ad1. The address Ad1 indicates the address of the dynamic link information T.
The CALL instruction b is an instruction that specifies an address constant t and a variable En as a parameter (argument) and calls the dynamic link unit 12 (transfers control).
The CALL instruction c is an instruction for transferring control to the program at the address set in the variable En.
[0032]
The program 23 is an external module (external program) to be dynamically linked with the program 21, and is stored in the auxiliary storage device in an initial state.
Note that the program 23 is also loaded into the storage space and executed by the arithmetic processing unit (CPU or the like).
[0033]
Further, the program load unit 11 updates the address constant b at the start of the execution of the program 21. Specifically, the program load unit 11 converts the address constant b into a format shown in FIG. Then, the program 22 is generated in the storage space, and the execution start address of the program 22 is set to the address Ad1.
[0034]
The dynamic link unit 12 includes, for example, a system program or the like, and is called by the program 22 described above. The dynamic link unit 12 specifies the program 23 to be dynamically linked according to the dynamic link information T of the program 21. Then, the specified program 23 is dynamically loaded into the storage space, the execution start address of the program 23 is set in the variable En, and the program 23 is returned to the program 22.
[0035]
Hereinafter, the operation of the dynamic link method according to the embodiment of the present invention will be described with reference to FIG.
FIG. 3 is a flowchart illustrating a dynamic link control process executed by the program load unit 11 and the dynamic link unit 12. This process is started after the computer system is instructed to execute the program 21 as the main program.
[0036]
First, the program loading unit 11 loads the program 21 to be executed into the storage space (Step S11). That is, as shown in FIG. 4A, the program 21 is loaded from the auxiliary storage device into the storage space by the program loading unit 11.
The program loading unit 11 searches for an address constant b included in the program 21 (Step S12).
[0037]
The program load unit 11 determines whether or not the flag F is unresolved based on the retrieved address constant b (step S13). That is, it is determined whether or not the value of the flag F in the address constant b as shown in FIG.
When determining that the link is not unresolved (the link has been resolved), the program load unit 11 proceeds to step S17 described below. On the other hand, when it is determined that the link of the flag F is unresolved, the program load unit 11 generates the program 22 in the storage space (Step S14). That is, as shown in FIG. 4A, the program 22 is generated in the storage space by the program load unit 11.
[0038]
Then, the program load unit 11 sets the address of the dynamic link information T in the address constant t of the generated program 22. (Step S15) Also, the program load unit 11 converts the address constant b of the program 21 from the format of FIG. 2A to the format of FIG. 2B, and sets the execution start address of the program 22 in the address Ad1. It is set (step S16).
[0039]
The program load unit 11 determines whether or not the address constant b searched in step S12 is the last address constant (step S17). That is, it is determined whether or not processing has been performed for all address constants b in the program 21.
When determining that it is not the last address constant, the program load unit 11 returns the process to step S12, and repeatedly executes the processes of steps S12 to S17 described above. On the other hand, when it is determined that the address constant is the last one, the preparation before execution is completed, and the execution of the program 21 is started (step S18).
[0040]
When the execution of the program 21 is started and the CALL instruction a is executed, control is transferred to the program 22 in accordance with the execution (step S19).
This is because the execution start address of the program 22 is set in the address constant b (address Ad1) in step S16 described above. That is, as shown in FIG. 4A, the CALL instruction a is executed, the address constant b (address Ad1) is referred, and the control is transferred to the program 22.
[0041]
When the control is transferred to the program 22 and the CALL instruction b is executed for the first time, the control is transferred to the dynamic link unit 12 with the execution (step S20). That is, as shown in FIG. 4A, the dynamic link unit 12 is called by specifying the address constant t and the variable En as parameters by the CALL instruction b.
[0042]
The dynamic link unit 12 loads the program 23 to be dynamically linked into the storage space (Step S21). That is, as shown in FIG. 4B, when the dynamic link unit 12 acquires the dynamic link information T with reference to the address constant t of the parameter, the dynamic link unit 12 performs dynamic link according to the acquired dynamic link information T. The program 23 to be targeted is specified. Then, the program 23 is dynamically loaded from the auxiliary storage device to the storage space.
The dynamic linking unit 12 sets the execution start address of the program 23 in the variable En and returns it to the program 22 (Step S22). That is, the execution start address of the program 23 is set in the variable En, and the control returns to the program 22.
[0043]
When control is returned to the program 22 and the CALL instruction c is subsequently executed, the execution of the program 23 is started with this execution (step S23). That is, as shown in FIG. 4C, since the execution start address of the program 23 is set in the variable En, the program 23 is called and executed.
[0044]
As described above, the dynamic link control processing can appropriately call an external module (external program) while solving the problem of the conventional dynamic link method.
That is, the dynamic link method according to the embodiment of the present invention has the following effects.
[0045]
First, the first effect is that the size of the storage space can be increased. This is because when the program 21 is executed, the address constant b is converted from the format of FIG. 2A to the format of FIG. 2B. That is, at the start of the program 21, the flag F in FIG. 2A becomes unnecessary, and the address constant b can be used only for address setting, and the size of the storage space can be expanded (corresponding to the first problem). ).
[0046]
The second effect is that even when both the program 21 and the program 23 are shared by a plurality of tasks, the application program (program 21) does not need a mechanism for synchronizing the tasks. It is. This is because the address constant b is not dynamically rewritten after the execution of the program 21 is started. That is, while a certain task is updating the address constant b, another task does not refer to the address constant b, so that the program 21 does not require a mechanism for synchronizing the tasks (second problem). Correspondence).
[0047]
The third effect is that the program 21 can be dynamically linked from the program 21 even when the program 21 is shared between a plurality of tasks and the program 23 is not shared between tasks. This is because the position of the address constant t of the intermediary program 22 differs for each task. In other words, even when the execution start address of the program 23 differs depending on the task, the address can be set to the address constant t, so that the program 23 can be dynamically linked from the program 21 (corresponding to the third problem). ).
[0048]
Further, the fourth effect is that it is not necessary to recreate, recompile, or relink the program 21 and the program 23 when adopting this method.
[0049]
In the above-described embodiment, the program load unit 11 generates the program 22 acting as an intermediary in the storage space, but the method of generating the program 22 is arbitrary.
For example, the program loading unit 11 may generate the program 22 according to a template program.
Hereinafter, a modified example of the present invention will be briefly described with reference to FIG. FIG. 5 is a block diagram showing an example of a configuration of a dynamic link system applied to another embodiment of the present invention.
[0050]
As shown in the figure, the dynamic link system includes a program load unit 11, a dynamic link unit 12, a program 21, a program 22, a program 23, and a template program 31.
Note that the configuration of the program loading units 11 to 23 is the same as that of the dynamic link system shown in FIG. 1 described above.
The template program 31 is arranged in a system program area in the virtual space and serves as a template for the program 22.
That is, the program load unit 11 generates the program 22 by copying the template program 31 to a storage space (a user program execution area or the like).
[0051]
This dynamic link method also operates in the above-described dynamic link control processing of FIG. A specific difference is a place where the program 22 is generated (step S14).
That is, in step S14 for generating the program 22 in the storage space, the program loading unit 11 generates the program 22 by copying the template program 31 from the system program area to the user program execution area.
[0052]
The dynamic link method shown in FIG. 5 can appropriately call an external module (external program) while solving the problem of the conventional dynamic link method.
[0053]
Note that the dynamic link system according to the embodiment of the present invention can be realized using an ordinary computer system without using a dedicated device. For example, a dynamic link scheme for executing the above-described processing is configured by installing the program from a medium (a flexible disk, a CD-ROM, or the like) storing a program for executing any of the above-described programs in a computer. Can be.
[0054]
The method for supplying the program to the computer is arbitrary. For example, the information may be supplied via a communication line, a communication network, a communication system, or the like. As an example, the program is posted on a bulletin board (BBS) of a communication network, and is superimposed on a carrier wave and distributed via the network.
Then, by starting this program and executing it in the same manner as other application programs under the control of the OS, the above-described processing can be executed.
[0055]
【The invention's effect】
As described above, according to the present invention, an external module (external program) can be appropriately called in an electronic computer system.
[Brief description of the drawings]
FIG. 1 is a schematic diagram showing an example of a configuration of a dynamic link system according to an embodiment of the present invention.
FIGS. 2A and 2B are schematic diagrams illustrating an example of a structure of an address constant included in a program to be executed, wherein FIG. 2A is a diagram of an address constant before execution is started, and FIG. FIG.
FIG. 3 is a flowchart illustrating a dynamic link control process according to the embodiment of the present invention.
FIGS. 4A to 4C are schematic diagrams for explaining a specific operation of the dynamic link method.
FIG. 5 is a schematic diagram showing an example of a configuration of a dynamic link system according to another embodiment of the present invention.
FIGS. 6A to 6C are schematic diagrams for explaining a specific operation of a conventional dynamic link system.
FIG. 7 is a schematic diagram showing an example of a structure of an address constant included in a conventional program to be executed.
[Explanation of symbols]
11 Program Loading Unit 12 Dynamic Linking Units 21 to 23 Program 31 Template Program

Claims (7)

電子計算機システムにおいて、第1のプログラムから第2のプログラムを動的にリンクして実行させる動的リンク方式であって、
第1のプログラムを記憶空間にロードし、
第1のプログラムから第2のプログラムへの呼び出しを仲介する第3のプログラムを記憶空間に生成し、
記憶空間にロードされた第1のプログラムの呼び出し対象を、生成された第3のプログラムに変更し、
呼び出し対象が変更された第1のプログラムの実行に伴い、生成された第3のプログラムを実行させ、
呼び出し対象の第2のプログラムを記憶空間にロードし、
ロードされた第2のプログラムの開始アドレスを、生成された第3のプログラムに設定し、
開始アドレスが設定された第3のプログラムの実行に伴い、呼び出された第2のプログラムを実行させる、
ことを特徴とする動的リンク方式。
In a computer system, a dynamic link system for dynamically linking and executing a second program from a first program,
Loading the first program into storage space,
Generating, in storage space, a third program that mediates a call from the first program to the second program;
Changing the call target of the first program loaded into the storage space to the generated third program;
With the execution of the first program whose call target has been changed, the generated third program is executed,
Load the second program to be called into the storage space,
Setting the start address of the loaded second program in the generated third program;
Causing the called second program to be executed with execution of the third program in which the start address is set;
A dynamic link method characterized by the following.
電子計算機システムにおいて、第1のプログラムから第2のプログラムを動的にリンクして実行させる動的リンク方式であって、
第1のプログラムを記憶空間にロードした際に、第1のプログラムから第2のプログラムへの呼び出しを仲介する第3のプログラムを記憶空間に生成すると共に、記憶空間にロードした第1のプログラムの呼び出し対象を、生成した第3のプログラムに変更するプログラムロード手段と、
呼び出し対象が変更された第1のプログラムが実行され、生成された第3のプログラムが実行した際に、第2のプログラムを記憶空間にロードすると共に、ロードした第2のプログラムの開始アドレスを、生成された第3のプログラムに設定して、第3のプログラムから呼び出された第2のプログラムを実行する動的リンク手段と、
を備えることを特徴とする動的リンク方式。
In a computer system, a dynamic link system for dynamically linking and executing a second program from a first program,
When the first program is loaded into the storage space, a third program that mediates a call from the first program to the second program is generated in the storage space, and the third program that is loaded into the storage space is generated. Program loading means for changing the call target to the generated third program;
When the first program whose call target is changed is executed and the generated third program is executed, the second program is loaded into the storage space, and the start address of the loaded second program is set to Dynamic linking means for setting the generated third program and executing the second program called from the third program;
A dynamic link method comprising:
動的リンクの対象を示す動的リンク情報と、動的リンクが未解決であるか否かを示すフラグ及び、呼び出し対象のアドレスからなるアドレス定数と、を含む第1のプログラムから第2のプログラムを動的にリンクして実行させる動的リンク方式であって、
第1のプログラムを記憶空間にロードした際に、フラグを含まないアドレス定数及び、呼び出し命令を含んだ第3のプログラムを記憶空間に生成する生成手段と、
生成された第3のプログラムのアドレス定数に動的リンク情報のアドレスをセットするセット手段と、
記憶空間にロードされた第1のプログラムのアドレス定数を、フラグを排除し、生成された第3のプログラムのアドレスに変更する変更手段と、
アドレス定数が変更された第1のプログラムが実行され、生成された第3のプログラムが実行した際に、第1のプログラムの動的リンク情報に従って、第2のプログラムを記憶空間にロードするロード手段と、
ロードされた第2のプログラムの開始アドレスを、生成された第3のプログラムの呼び出し命令に設定する設定手段と、
開始アドレスが設定された呼び出し命令の実行により、呼び出された第2のプログラムを実行するリンク手段と、
を備えることを特徴とする動的リンク方式。
A first program to a second program including dynamic link information indicating a target of a dynamic link, a flag indicating whether the dynamic link is unresolved, and an address constant including an address of a call target. Is a dynamic link method for dynamically linking and executing
Generating means for generating, in the storage space, an address constant not including a flag and a third program including a call instruction when the first program is loaded into the storage space;
Setting means for setting the address of the dynamic link information to the address constant of the generated third program;
Changing means for changing the address constant of the first program loaded into the storage space to an address of the generated third program, excluding the flag;
Loading means for loading the second program into the storage space according to the dynamic link information of the first program when the first program whose address constant has been changed is executed and the generated third program is executed When,
Setting means for setting the start address of the loaded second program in the generated call instruction of the third program;
Link means for executing the called second program by executing the call instruction in which the start address is set;
A dynamic link method comprising:
プログラムからプログラムへの呼び出しを仲介する雛形プログラムを更に備え、
前記生成手段は、前記雛形プログラムに従って、第3のプログラムを記憶空間に生成する、
ことを特徴とする請求項3に記載の動的リンク方式。
Further comprising a template program that mediates calls from program to program,
The generating means generates a third program in a storage space according to the template program.
The dynamic link method according to claim 3, wherein:
電子計算機システムにおいて、第1のプログラムから第2のプログラムを動的にリンクして実行させる動的リンク制御方法であって、
第1のプログラムを記憶空間にロードするステップと、
第1のプログラムから第2のプログラムへの呼び出しを仲介する第3のプログラムを記憶空間に生成するステップと、
記憶空間にロードされた第1のプログラムの呼び出し対象を、生成された第3のプログラムに変更するステップと、
呼び出し対象が変更された第1のプログラムの実行に伴い、生成された第3のプログラムを実行させるステップと、
呼び出し対象の第2のプログラムを記憶空間にロードするステップと、
ロードされた第2のプログラムの開始アドレスを、生成された第3のプログラムに設定するステップと、
開始アドレスが設定された第3のプログラムの実行に伴い、呼び出された第2のプログラムを実行させるステップと、
を備えることを特徴とする動的リンク制御方法。
A dynamic link control method for dynamically linking and executing a second program from a first program in an electronic computer system,
Loading a first program into storage space;
Generating, in storage space, a third program that mediates a call from the first program to the second program;
Changing the call target of the first program loaded into the storage space to the generated third program;
Causing the generated third program to be executed with execution of the first program whose call target has been changed;
Loading a second program to be called into a storage space;
Setting the start address of the loaded second program in the generated third program;
Executing the called second program with execution of the third program in which the start address is set;
A dynamic link control method comprising:
動的リンクの対象を示す動的リンク情報と、動的リンクが未解決であるか否かを示すフラグ及び、呼び出し対象のアドレスからなるアドレス定数と、を含む第1のプログラムから第2のプログラムを動的にリンクして実行させる動的リンク制御方法であって、
第1のプログラムを記憶空間にロードした際に、フラグを含まないアドレス定数及び、呼び出し命令を含んだ第3のプログラムを記憶空間に生成する生成ステップと、
生成された第3のプログラムのアドレス定数に動的リンク情報のアドレスをセットするセットステップと、
記憶空間にロードされた第1のプログラムのアドレス定数を、フラグを排除し、生成された第3のプログラムのアドレスに変更する変更ステップと、
アドレス定数が変更された第1のプログラムが実行され、生成された第3のプログラムが実行した際に、第1のプログラムの動的リンク情報に従って、第2のプログラムを記憶空間にロードするロードステップと、
ロードされた第2のプログラムの開始アドレスを、生成された第3のプログラムの呼び出し命令に設定する設定ステップと、
開始アドレスが設定された呼び出し命令の実行により、呼び出された第2のプログラムを実行するリンクステップと、
を備えることを特徴とする動的リンク制御方法。
A first program to a second program including dynamic link information indicating a target of a dynamic link, a flag indicating whether the dynamic link is unresolved, and an address constant including an address of a call target. Dynamic link control method for dynamically linking and executing
A generation step of generating, in the storage space, an address constant not including a flag and a third program including a call instruction when the first program is loaded into the storage space;
Setting an address of the dynamic link information to an address constant of the generated third program;
Changing the address constant of the first program loaded into the storage space to the address of the generated third program, excluding the flag;
A load step of loading the second program into the storage space according to the dynamic link information of the first program when the first program whose address constant has been changed is executed and the generated third program is executed When,
A setting step of setting a start address of the loaded second program to a generated call instruction of the third program;
A link step of executing the called second program by executing a call instruction in which a start address is set;
A dynamic link control method comprising:
コンピュータに、
第1のプログラムを補助記憶装置から記憶空間にロードするステップと、第1のプログラムから第2のプログラムへの呼び出しを仲介する第3のプログラムを記憶空間に生成するステップと、記憶空間にロードされた第1のプログラムの呼び出し対象を、生成された第3のプログラムに変更するステップと、呼び出し対象が変更された第1のプログラムの実行に伴い、生成された第3のプログラムを演算処理部に実行させるステップと、呼び出し対象の第2のプログラムを補助記憶装置から記憶空間にロードするステップと、ロードされた第2のプログラムの開始アドレスを、生成された第3のプログラムに設定するステップと、開始アドレスが設定された第3のプログラムの実行に伴い、呼び出された第2のプログラムを演算処理部に実行させるステップと、
を実行させるためのプログラム。
On the computer,
Loading the first program from the auxiliary storage device into the storage space; generating a third program in the storage space that mediates a call from the first program to the second program; and loading the third program into the storage space. Changing the call target of the first program to the generated third program, and executing the generated third program to the arithmetic processing unit with the execution of the first program whose call target has been changed. Executing, loading the second program to be called from the auxiliary storage device into the storage space, and setting the start address of the loaded second program in the generated third program; The called second program is executed by the arithmetic processing unit with the execution of the third program in which the start address is set. And the step of,
The program to execute.
JP2002353534A 2002-12-05 2002-12-05 Dynamic link method, dynamic link control method and program Expired - Fee Related JP3918096B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002353534A JP3918096B2 (en) 2002-12-05 2002-12-05 Dynamic link method, dynamic link control method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002353534A JP3918096B2 (en) 2002-12-05 2002-12-05 Dynamic link method, dynamic link control method and program

Publications (2)

Publication Number Publication Date
JP2004185472A true JP2004185472A (en) 2004-07-02
JP3918096B2 JP3918096B2 (en) 2007-05-23

Family

ID=32754801

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002353534A Expired - Fee Related JP3918096B2 (en) 2002-12-05 2002-12-05 Dynamic link method, dynamic link control method and program

Country Status (1)

Country Link
JP (1) JP3918096B2 (en)

Also Published As

Publication number Publication date
JP3918096B2 (en) 2007-05-23

Similar Documents

Publication Publication Date Title
WO2015165232A1 (en) Driver program loading method and embedded device
US7802252B2 (en) Method and apparatus for selecting the architecture level to which a processor appears to conform
JP2002529812A (en) System for altering the functionality of computer code compiled at runtime
US8214815B2 (en) Reducing the run-time cost of invoking a server page
JP4873423B2 (en) Virtualization program, simulation apparatus, and virtualization method
JP2010086410A (en) Memory protection method, information processing apparatus, memory protection program and recording medium with memory protection program recorded thereon
JP2005284491A (en) Starting time shortening system for computer
JP2681929B2 (en) Program start method
JP2006163840A (en) Information processor and its method
JP2007206933A (en) Information processor, boot loader generation method and program transfer method in information processor
JPH03229352A (en) Program changing method
CN114721735B (en) Program dynamic loading method and device and electronic equipment
JP3918096B2 (en) Dynamic link method, dynamic link control method and program
US8010955B2 (en) Reducing the run-time cost of incorporating custom tags in a server page
JP2007257560A (en) Tracing method of program executed on system with a plurality of processors, and system with a plurality of processors
JP2004348327A (en) Digital signal processor and digital signal processing method
JP2005258967A (en) Data processor
JPH09231069A (en) Method and device for information processing
JP2003256219A (en) Program execution method in incorporated equipment
JP4967555B2 (en) Multiprocessor system
JP2005275703A (en) Processor, and context switching method
JP2006113935A (en) Dynamic link library calling code generation method, program, and apparatus
JP2002182931A (en) Common os system call method
JP2005084900A (en) Program management system
JP2000231494A (en) Software execution system and software executing method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040427

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060711

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060908

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20070116

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20070126

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20070129

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20080526

A072 Dismissal of procedure

Free format text: JAPANESE INTERMEDIATE CODE: A072

Effective date: 20080909

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100223

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110223

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110223

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120223

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120223

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130223

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130223

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140223

Year of fee payment: 7

LAPS Cancellation because of no payment of annual fees