[英]Unable to find entry point in tm1api.dll
I am attempting to write a C# application connecting to a Cognos TM1 datastore using the tm1api.dll. 我正在尝试编写使用tm1api.dll连接到Cognos TM1数据存储区的C#应用程序。 I have created a basic shell project in VS C# Express 2008, and added the following code 我在VS C#Express 2008中创建了一个基本的shell项目,并添加了以下代码
public partial class MainPortal : Window
{
[System.Runtime.InteropServices.DllImport(@"C:\\Program Files\\Cognos\\TM1\\bin\\tm1api.dll", EntryPoint="TM1APIInitialise")]
public static extern void TM1APIInitialise();
public MainPortal()
{
InitializeComponent();
TM1APIInitialise();
}
}
I can build this project with no errors, but when running I get the following error: 我可以毫无错误地构建此项目,但是在运行时出现以下错误:
"Unable to find an entry point named 'TM1APIInitialise' in DLL 'C:\\\\Program Files\\\\Cognos\\\\TM1\\\\bin\\\\tm1api.dll'." “无法在DLL'C:\\\\ Program Files \\\\ Cognos \\\\ TM1 \\\\ bin \\\\ tm1api.dll'中找到名为'TM1APIInitialise'的入口点。”
I have used 'dumpbin /exports tm1api.dll' to determine its entry point: 我已经使用“ dumpbin / exports tm1api.dll”确定其入口点:
101 5D 00008360 TM1APIFinalize
Now I am at a loss, it seems to have an entry point but does recognize it. 现在我很茫然,它似乎有一个切入点,但确实可以识别它。 Can anyone point me in the right direction? 谁能指出我正确的方向?
PS. PS。 I am completely new to C#, so I may be making extremely basic mistakes :) 我是C#的新手,所以我可能犯了非常基本的错误:)
try this 尝试这个
public partial class MainPortal : Window
{
[System.Runtime.InteropServices.DllImport(@"C:\Program Files\Cognos\TM1\bin\tm1api.dll", EntryPoint="TM1APIFinalize")]
public static extern void TM1APIFinalize();
public MainPortal()
{
InitializeComponent();
TM1APIInitialise();
}
}
It appears you have the name of the entrypoint wrong "TM1APIInitialise" versus "TM1APIFinalize". 看来您的入口点名称错误,是“ TM1APIInitialise”和“ TM1APIFinalize”。 Also, you don't need to escape the backslashes \\ if you use the string literal @. 另外,如果使用字符串文字@,则不需要转义反斜杠\\。
Thanks JP and ArsenMkrt, your answers both lead to me working out the issue. 感谢JP和ArsenMkrt,您的回答都导致我解决了该问题。
I had it defined as TM1APIInitialise and it should have been TM1APIInitialize. 我已将其定义为TM1APIInitialise,而应该将其定义为TM1APIInitialize。
Note the 's' instead of the 'z' (damn American spelling) :). 注意“ s”而不是“ z”(该死的美国拼写):)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.