无法在 tm1api.dll 中找到入口点
我正在尝试编写一个使用 tm1api.dll 连接到 Cognos TM1 数据存储的 C# 应用程序。 我在 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();
}
}
我可以毫无错误地构建该项目,但运行时出现以下错误:
“无法在 DLL 中找到名为 TM1APIInitialise 的入口点” C:\\Program Files\\Cognos\\TM1\\bin\\tm1api.dll'。”
我已经使用“dumpbin /exports tm1api.dll”来确定它的入口点:
101 5D 00008360 TM1APIFinalize
现在我不知所措,它似乎有一个入口点但确实识别它。 有人能指出我正确的方向吗?
附言。 我对 C# 完全陌生,所以我可能会犯一些非常基本的错误:)
I am attempting to write a C# application connecting to a Cognos TM1 datastore using the tm1api.dll. I have created a basic shell project in VS C# Express 2008, and added the following code
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'."
I have used 'dumpbin /exports tm1api.dll' to determine its entry point:
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. I am completely new to C#, so I may be making extremely basic mistakes :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看来您的入口点名称错误“TM1APIInitialise”与“TM1APIFinalize”。 另外,如果使用字符串文字 @,则不需要转义反斜杠 \。
It appears you have the name of the entrypoint wrong "TM1APIInitialise" versus "TM1APIFinalize". Also, you don't need to escape the backslashes \ if you use the string literal @.
尝试这个
try this
谢谢 JP 和 ArsenMkrt,你们的回答都让我解决了这个问题。
我将其定义为 TM1APIInitialize,它应该是 TM1APIInitialize。
注意“s”而不是“z”(该死的美国拼写):)。
Thanks JP and ArsenMkrt, your answers both lead to me working out the issue.
I had it defined as TM1APIInitialise and it should have been TM1APIInitialize.
Note the 's' instead of the 'z' (damn American spelling) :).