无法在 tm1api.dll 中找到入口点

发布于 2024-07-27 22:56:07 字数 805 浏览 2 评论 0原文

我正在尝试编写一个使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

转身以后 2024-08-03 22:56:07

看来您的入口点名称错误“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 @.

星軌x 2024-08-03 22:56:07

尝试这个

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();
    }
}

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();
    }
}
澉约 2024-08-03 22:56:07

谢谢 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) :).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文