【问题标题】:Use shared library created with Matlab Compiler SDK in OMNeT++ simulation在 OMNeT++ 仿真中使用使用 Matlab Compiler SDK 创建的共享库
【发布时间】:2021-03-26 17:34:28
【问题描述】:

我正在尝试从我的 OMNeT 模拟中调用 Matlab 函数。因此,我使用 mwArray API 创建了一个共享库。但是,当我尝试运行示例代码时,模拟终止并显示以下错误消息:

最终启动顺序出错:

执行 MI 命令失败: -执行运行 来自调试器后端的错误消息: 在启动过程中,程序以代码 0xc0000135 退出。 执行 MI 命令失败: -执行运行 来自调试器后端的错误消息: 在启动过程中,程序以代码 0xc0000135 退出。 在启动过程中程序退出,代码为 0xc0000135。

有没有其他人遇到过同样的问题?

我在 Windows 下使用 OMNeT 5.6.2 和 Matlab 2020a

我的模块的代码是

    #include <omnetpp.h>
    #include "compilerTest.h"
    
    using namespace omnetpp;
    
    class ExampleModule : public cSimpleModule
    {
        protected:
            simtime_t timerInterval;
            cMessage * timer;
        protected:
            virtual void initialize();
            virtual void handleMessage(cMessage *msg);
    };
    
    Define_Module(ExampleModule);
    
    void ExampleModule::initialize()
    {
        timerInterval = 1.0;
        timer = new cMessage("timer");
        scheduleAt(simTime() + timerInterval, timer);
    }
    
    void ExampleModule::handleMessage(cMessage *msg)
    {
        if (msg->isSelfMessage()){
                bool x = mclInitializeApplication(NULL, 0);
    
                scheduleAt(simTime() + timerInterval, timer);
        }
    }

【问题讨论】:

    标签: omnet++ matlab-compiler


    【解决方案1】:

    该消息表明在进程启动期间发生了错误。这意味着该进程可能无法加载 Matlab 运行时 DLL。 Matlab DLL 所在的目录必须存在于系统路径中,以便操作系统可以加载它们。在 Windows 上,尤其难以避免 DLL 地狱并修复这些问题(主要是因为缺少正确的错误消息)。首先,我会尝试从 MinGW env 命令提示符启动示例,您可以在其中手动控制 PATH 并尝试仅在命令行中运行后从 IDE 运行。

    【讨论】:

      猜你喜欢
      • 2017-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-30
      • 1970-01-01
      • 1970-01-01
      • 2018-06-26
      • 1970-01-01
      相关资源
      最近更新 更多