0

さて、LabWindows を使用して Tcl 8.4 用に C で記述された拡張機能があります。Tcl 8.6 にアップグレードした後、dll によって生成されたプロシージャを呼び出すと、有用なエラー コードを生成することなく、wish がクラッシュします。これは、スクリプトと、ライブラリを手動でロードして、ウィッシュ シェルからプロシージャを呼び出した場合の両方で発生します。

これは、Tcl 8.4 の上に Tcl 8.6 をインストールした場合にのみ発生します。8.6 を新規インストールすると、dll に依存ライブラリがありませんと表示されます。そのため、依存関係ウォーカーを使用して、dll が tcl84.dll に依存していることを確認しましたが、Visual Studio(VS) で作成した拡張機能や他の古い LabWindows プロジェクトでさえ、依存関係としてリストされていません。

ご想像のとおり、tcl84.dll が依存関係としてリストされていないプロジェクトは、Tcl 8.6 で問題なく動作します。新規インストールと 8.4 の上にインストールされています。

では、拡張機能が tcl84.dll に依存しているのに、他の拡張機能が依存していない理由を知っている人はいますか?

ソースは次のとおりです。

SI.c initメソッドまでしかない(ファイル全体が大きすぎる)

#include <analysis.h>
#include "toolbox.h"
#include <utility.h>
#include <ansi_c.h>
#include "SI.h"

////////////////////////////////////////////////////////////////////////////////////////////////////
int DLLEXPORT Si_Init(Tcl_Interp *interp) {
////////////////////////////////////////////////////////////////////////////////////////////////////

    if (Tcl_InitStubs(interp, "8.4", 0) == NULL) {
        return TCL_ERROR;
    }

    //TCL Exported Functions
    Tcl_CreateObjCommand(interp, "LoadWfm", (Tcl_ObjCmdProc*)LoadWfm,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    Tcl_CreateObjCommand(interp, "SaveWfm", (Tcl_ObjCmdProc*)SaveWfm,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    Tcl_CreateObjCommand(interp, "Step2SParam", (Tcl_ObjCmdProc*)Step2SParam,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    Tcl_CreateObjCommand(interp, "Step2Eye", (Tcl_ObjCmdProc*)Step2Eye,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);

    Tcl_PkgProvide(interp, "SI", "1.0");

    return TCL_OK;
}

SI.h

//Exported Functions
int DLLEXPORT Si_Init(Tcl_Interp *interp);
int DLLEXPORT LoadWfm(ClientData clientData, Tcl_Interp *interp,int objc, Tcl_Obj *CONST objv[]);
int DLLEXPORT SaveWfm(ClientData clientData, Tcl_Interp *interp,int objc, Tcl_Obj *CONST objv[]);
int DLLEXPORT Step2SParam(ClientData clientData, Tcl_Interp *interp,int objc, Tcl_Obj *CONST objv[]);
int DLLEXPORT Step2Eye(ClientData clientData, Tcl_Interp *interp,int objc, Tcl_Obj *CONST objv[]);

//Local Functions
int StepToSParam (double *vin, double *vout, double dt, int N, double **S_real_out, double **S_imag_out, double *S_f0_out, double *S_df_out, int *S_N_out);
double RisetimeToBandwidth_20_80(double x);
double RisetimeToBandwidth_10_90(double x);
int GaussianFilter(double *Waveform, int Samples, double SampleTime, int BitPoints, double Bandwidth);
int NormalizeAmplitude (double *Waveform, int Samples, double Vpp);
int FunctionGenerator(int BitPattern[], int PatternLength, int PatternCycles, double Freq, double Vpp, double Risetime, 
                        int Risetime2080, double dt, int *Samples, double **Waveform);
int ZeroPad (double **wfm, int N, int NewN);
int ParZ(double Z1_Re, double Z1_Im, double Z2_Re, double Z2_Im, double *ZT_Re, double *ZT_Im);
int ReflCoef(double Z1_Re, double Z1_Im, double Z2_Re, double Z2_Im, double *ZRefl_Re, double *ZRefl_Im);
int SixCompEq(double f, double Zcab, double Rld, double R1, double C, double R3, double L, double *T_Re, double *T_Im);
int FourCompEq(double f, double Zcab, double Rld, double R1, double C, double R3, double L, double *T_Re, double *T_Im);
int ApplyEq(int NumComponents, int EQ_N, double df, double Zcab, double Rld, double R1, 
    double C, double R3, double L, double *T_Re, double *T_Im);
int SimulateEye (double *in, double *out, int N, double dt,
                 char *Pattern_String, int Pattern_Inverted, int Pattern_Cycles, double Pattern_BitRate, 
                 double Pattern_Risetime, int Pattern_2080, double Pattern_Amplitude,
                 int EQ_NumComponents, double EQ_Zcab, double EQ_Rld, double EQ_R1, double EQ_C, double EQ_R3, double EQ_L, 
                 double **Eye_Pattern, double *Eye_dt, int *Eye_N);
int FindPatternStartIndex(double *EyeWfm, double Eye_dt, int Eye_N, double Pattern_Bitrate, int Pattern_Bits, int Pattern_Cycles);

LabWindows に詳しい方のために、プロジェクト設定ファイルは次のとおりです。

SI.prj

[Project Header]
Version = 800
Pathname = "/c/CVS_CHECKOUT/MHTS/SI/SI.prj"
CVI Dir = "/c/program files/national instruments/cvi80"
IVI Standard Root Dir = "/C/Program Files/IVI"
VXIplug&play Framework Dir = "/C/VXIPNP/winnt"
Number of Files = 4
Target Type = "Dynamic Link Library"
Flags = 16

[File 0001]
File Type = "Include"
Res Id = 1
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../Include/molex_tcl.h"
Path = "/c/CVS_CHECKOUT/MHTS/Include/molex_tcl.h"
Exclude = False
Project Flags = 0
Folder = "Included Files"

[File 0002]
File Type = "CSource"
Res Id = 2
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "SI.c"
Path = "/c/CVS_CHECKOUT/MHTS/SI/SI.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "Source Files"

[File 0003]
File Type = "Include"
Res Id = 3
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "SI.h"
Path = "/c/CVS_CHECKOUT/MHTS/SI/SI.h"
Exclude = False
Project Flags = 0
Folder = "Source Files"

[File 0004]
File Type = "Library"
Res Id = 4
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../Include/tclDecls.lib"
Path = "/c/CVS_CHECKOUT/MHTS/Include/tclDecls.lib"
Exclude = False
Project Flags = 0
Folder = "Included Files"

[Folders]
Include Files Folder Not Added Yet = True
User Interface Files Folder Not Added Yet = True
Instrument Files Folder Not Added Yet = True
Folder 0 = "Source Files"
Folder 1 = "Included Files"

[Compiler Options]
Default Calling Convention = "cdecl"
Require Prototypes = True
Require Return Values = True
Enable Pointer Mismatch Warning = False
Enable Unreachable Code Warning = False
Enable Unreferenced Identifiers Warning = False
Enable Assignment In Conditional Warning = False
O Option Compatible With 5.0 = False
Uninitialized Locals Compile Warning = "Conservative"

[Run Options]
Stack Size = 250000
Image Base Address = 4194304

[Compiler Defines]
Compiler Defines = "/DWIN32_LEAN_AND_MEAN /D_MSC_VER=1200 /D_WINDEF_"

[Include Paths]
Include Path 1 Is Rel = False
Include Path 1 = "/c/CVS_CHECKOUT/MHTS/Include"
Include Path 2 Is Rel = False
Include Path 2 = "/c/Tcl/include"

[Create Executable]
Executable File_Debug Is Rel = True
Executable File_Debug Rel To = "Project"
Executable File_Debug Rel Path = "SI_dbg.dll"
Executable File_Debug = "/c/CVS_CHECKOUT/MHTS/SI/SI_dbg.dll"
Executable File_Release Is Rel = True
Executable File_Release Rel To = "Project"
Executable File_Release Rel Path = "SI.dll"
Executable File_Release = "/c/CVS_CHECKOUT/MHTS/SI/SI.dll"
Icon File Is Rel = False
Icon File = ""
Application Title = ""
DLL Exports = "Symbols Marked As Export"
DLL Import Library Choice = "Gen Lib For Current Mode"
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Add Type Lib To DLL = False
Include Type Lib Help Links = False
Type Lib FP File Is Rel = False
Type Lib FP File = ""
Type Lib Guid = ""
Runtime Support = "Full Runtime Support"
Instrument Driver Support Only = False
Embed Project .UIRs = False
Generate Map File = False

[External Compiler Support]
UIR Callbacks File Option = 0
Using LoadExternalModule = False
Create Project Symbols File = True
UIR Callbacks Obj File Is Rel = False
UIR Callbacks Obj File = ""
Project Symbols H File Is Rel = False
Project Symbols H File = ""
Project Symbols Obj File Is Rel = False
Project Symbols Obj File = ""

[ActiveX Server Options]
Specification File Is Rel = False
Specification File = ""
Source File Is Rel = False
Source File = ""
Include File Is Rel = False
Include File = ""
IDL File Is Rel = False
IDL File = ""
Register ActiveX Server = False

[tpcSection]
tpcEnabled = 0
tpcOverrideEnvironment = 0

SI.cws

[Workspace Header]
Version = 800
Pathname = "/c/CVS_CHECKOUT/MHTS/SI/SI.cws"
CVI Dir = "/c/program files/national instruments/cvi80"
IVI Standard Root Dir = "/C/Program Files/IVI"
VXIplug&play Framework Dir = "/C/VXIPNP/winnt"
Number of Projects = 1
Active Project = 1
Project 0001 = "SI.prj"
Drag Bar Left = 323
Window Top = 137
Window Left = 1190
Window Bottom = 1041
Window Right = 2278
Maximized = True
Maximized Children = True
Max Number Of Errors = 20
Track Include File Dependencies = True
Prompt For Missing Includes = True
Stop On First Error File = False
Bring Up Err Win For Warnings = True
Show Build Dialog = False
Save Changes Before Running = "Always"
Hide Windows = False
Global Hot Key = False
Break At First Statement = False
Sort Type = "File Name"
Number of Opened Files = 3
Window Confinement Region Enabled = True
MainColumnWidth = 304
FileDateColumnWidth = 70
FileSizeColumnWidth = 70
StatusColumnWidth = 70

[Project Header 0001]
Version = 800
Don't Update DistKit = False
Platform Code = 4
Build Configuration = "Release"
Warn User If Debugging Release = 1
Batch Build Release = False
Batch Build Debug = False
Force Rebuild = False

[File 0001]
Path = "/c/CVS_CHECKOUT/MHTS/SI/SI.c"
File Type = "CSource"
Disk Date = 3288546022
In Projects = "1,"
Window Top = 163
Window Left = 78
Window Z-Order = 1
Source Window State = "1,191,191,191,54,55,55,0,0,116,0,25,0,25,0,51,150,0,192,6,349,676,1,0,"
Breakpoint 0001 = "166,0,enabled,"
Breakpoint 0002 = "195,0,enabled,"

[File 0002]
Path = "/c/CVS_CHECKOUT/MHTS/SI/SI.h"
File Type = "Include"
Disk Date = 3262700601
In Projects = "1,"
Window Top = 30
Window Left = 6
Window Z-Order = 2
Source Window State = "1,27,28,27,0,0,0,0,0,80,0,28,0,28,0,25,0,45,27,130,349,676,1,0,"

[File 0003]
Path = "/c/CVS_CHECKOUT/MHTS/Include/molex_tcl.h"
File Type = "Include"
Disk Date = 3275700706
In Projects = "1,"
Window Top = 30
Window Left = 6
Window Z-Order = 3
Source Window State = "1,15,16,16,86,159,159,0,0,80,0,0,0,0,0,25,0,0,35,33,349,676,1,0,"

[File 0004]
Path = "/c/CVS_CHECKOUT/MHTS/Include/tclDecls.lib"
File Type = "Library"
Disk Date = 3262622625
In Projects = "1,"

[Build Options 0001]
Generate Browse Info = True
Enable Uninitialized Locals Runtime Warning = True
Debugging Level = "Standard"
Break On Library Errors = False
Break On First Chance Exceptions = False
Execution Target Address = "Local desktop computer"
Execution Target Port = 0
Execution Target Type = 0

[SCC Options 0001]
Use global settings = True
SCC Provider = ""
SCC Project = ""
Local Path = ""
Auxiliary Path = ""
Perform Same Action For .h File As For .uir File = "Ask"
Username = ""
Comment = ""
Use Default Username = False
Use Default Comment = False
Suppress CVI Error Messages = False

[DLL Debugging Support 0001]
External Process Path = "/c/Tcl/bin/wish.exe"

[DLLs Used By Executable 0001]
DLL 0001 = "/C/Tcl/bin/tcl84.dll"

[Command Line Args 0001]
Command Line Args = ""

最も有望な可能性は、.cws ファイルの次の行です。

[DLLs Used By Executable 0001]
DLL 0001 = "/c/Tcl/bin/tcl84.dll"

しかし、これは別の LabWindows プロジェクトの .cws ファイルです。

OK.cws

[Workspace Header]
Version = 800
Pathname = "/c/CVS_CHECKOUT/MHTS/OK/OK.cws"
CVI Dir = "/c/program files/national instruments/cvi80"
IVI Standard Root Dir = "/C/Program Files/IVI"
VXIplug&play Framework Dir = "/C/VXIPNP/winnt"
Number of Projects = 1
Active Project = 1
Project 0001 = "OK.prj"
Drag Bar Left = 181
Window Top = 101
Window Left = 1404
Window Bottom = 974
Window Right = 2676
Maximized = True
Maximized Children = True
Max Number Of Errors = 20
Track Include File Dependencies = True
Prompt For Missing Includes = True
Stop On First Error File = False
Bring Up Err Win For Warnings = True
Show Build Dialog = False
Save Changes Before Running = "Always"
Hide Windows = False
Global Hot Key = False
Break At First Statement = False
Sort Type = "File Name"
Number of Opened Files = 1
Window Confinement Region Enabled = True
MainColumnWidth = 162
FileDateColumnWidth = 70
FileSizeColumnWidth = 70
StatusColumnWidth = 70

[Project Header 0001]
Version = 800
Don't Update DistKit = False
Platform Code = 4
Build Configuration = "Debug"
Warn User If Debugging Release = 1
Batch Build Release = False
Batch Build Debug = False
Force Rebuild = False

[File 0001]
Path = "/c/CVS_CHECKOUT/MHTS/OK/OK.c"
File Type = "CSource"
Disk Date = 3291811857
In Projects = "1,"
Window Top = 59
Window Left = 80
Window Z-Order = 1
Source Window State = "1,503,503,503,14,32,32,0,0,133,0,37,0,51,29,59,478,0,514,78,663,815,1,0,"

[File 0002]
Path = "/c/CVS_CHECKOUT/MHTS/Include/molex_tcl.h"
File Type = "Include"
Disk Date = 3275700706
In Projects = "1,"
Window Top = 48
Window Left = 18
Source Window State = "1,8,9,8,0,0,0,0,0,0,0,0,0,0,0,0,1,0,8,12,461,988,1,0,"

[File 0003]
Path = "/c/CVS_CHECKOUT/MHTS/OK/OK.h"
File Type = "Include"
Disk Date = 3291811853
In Projects = "1,"
Window Top = 614
Window Left = 299
Source Window State = "1,4,4,4,17,21,17,0,0,0,0,16,0,16,0,0,0,0,15,17,278,676,1,0,"

[File 0004]
Path = "/c/Program Files/Opal Kelly/FrontPanel/API/okFrontPanelDLL.h"
File Type = "Include"
Disk Date = 3268500132
In Projects = "1,"
Window Top = 130
Window Left = 11
Source Window State = "1,218,218,218,51,68,51,0,3,0,0,0,0,0,0,0,197,0,218,68,476,725,1,0,"

[File 0005]
Path = "/c/CVS_CHECKOUT/MHTS/Include/tclDecls.lib"
File Type = "Library"
Disk Date = 3262622625
In Projects = "1,"

[Build Options 0001]
Generate Browse Info = True
Enable Uninitialized Locals Runtime Warning = True
Debugging Level = "Standard"
Break On Library Errors = False
Break On First Chance Exceptions = False
Execution Target Address = "Local desktop computer"
Execution Target Port = 0
Execution Target Type = 0

[SCC Options 0001]
Use global settings = True
SCC Provider = ""
SCC Project = ""
Local Path = ""
Auxiliary Path = ""
Perform Same Action For .h File As For .uir File = "Ask"
Username = ""
Comment = ""
Use Default Username = False
Use Default Comment = False
Suppress CVI Error Messages = False

[DLL Debugging Support 0001]
External Process Path = "/c/Tcl/bin/wish.exe"

[DLLs Used By Executable 0001]
DLL 0001 = "/c/Tcl/bin/tcl84.dll"

[Command Line Args 0001]
Command Line Args = ""

...同じ行がありますが、このプロジェクトは Tcl 8.6 に更新した後も正常に動作します。

更新 2013 年 5 月 13 日 9:00 AM - これまでのすべての回答とコメントからわかることは、LabWindows ビルドの特異性と関係があることは間違いないということです。そのため、できれば今日の勤務日の終わりまでにそのコピーを取得し、結果で質問を更新します。

UPDATE 5/13/2013 2:13 PM - さて、LabWindows を入手し、最初に .cws ファイルの行を削除して再コンパイルを試みました。IDE は、コンパイル前に行を再生成するだけで、同じ結果になります。そのため、新しいプロジェクトを最初から作成し、.c ファイルと .h ファイルのみを取り込みました。すべてのインクルードとプロジェクト設定を手動でセットアップし、ビルドが成功したときに .cws ファイルを確認すると、行が再び自動生成され、同じ結果が生成されていました。したがって、tcl84.dll を参照している .c ファイルまたは .h ファイルに何らかの関数呼び出しまたは参照が必要です。追加の洞察をいただければ幸いです。

4

2 に答える 2

1

への呼び出しで Tcl STUBS サポートを適切に使用しますが、Tcl_InitStubs()Tcl84.dll とリンクすることでメリットを無視できます。

スタブを使用する場合は、必要な最も古い DLL のスタブ バージョンにリンクするだけで済みます。この場合、ライブラリは「tclstub84.lib」と呼ばれます。このスタティック ライブラリは、Tcl 8.6 が再コンパイルせずに 8.4 ライブラリをロードできるようにするために必要な魔法を処理します。

適切に動作させるには、おそらく TCL_USE_STUBS コンパイラ定義も必要です。

ライブラリの STUBS サポートを適切に有効にする方法の詳細については、http: //tcl.activestate.com/doc/howto/stubs.html を参照してください。

于 2013-05-10T18:06:30.403 に答える
1

あなたが持っているSI.cwsの奥深く

[DLLs Used By Executable 0001]
DLL 0001 = "/C/Tcl/bin/tcl84.dll"

依存関係がどこから来ているかのように見えます。

それは簡単なビットです。私は LabWindows と VisualStudio に慣れていないため、これを解決するために何をすべきかについて十分な情報がありません。

上記の行を変更して tcl86.dll を指定すると、魅力的に見えます:-)

于 2013-05-10T16:42:42.127 に答える