简体   繁体   English

在 OMNeT++ 仿真中使用使用 Matlab 编译器 SDK 创建的共享库

[英]Use shared library created with Matlab Compiler SDK in OMNeT++ simulation

I am trying to call Matlab Functions from my OMNeT simulation.我正在尝试从我的 OMNeT 模拟中调用 Matlab 函数。 Therefore I created a shared library using the mwArray API.因此,我使用 mwArray API 创建了一个共享库。 However, when I try to run the sample code, the simulation terminates with the following error message:但是,当我尝试运行示例代码时,模拟终止并显示以下错误消息:

Error in final launch sequence:最终启动顺序错误:

Failed to execute MI command: -exec-run Error message from debugger back end: During startup program exited with code 0xc0000135.无法执行 MI 命令:-exec-run 来自调试器后端的错误消息:在启动期间程序退出,代码为 0xc0000135。 Failed to execute MI command: -exec-run Error message from debugger back end: During startup program exited with code 0xc0000135.无法执行 MI 命令:-exec-run 来自调试器后端的错误消息:在启动期间程序退出,代码为 0xc0000135。 During startup program exited with code 0xc0000135.在启动过程中,程序以代码 0xc0000135 退出。

Did anyone else encounter the same problem?有没有其他人遇到过同样的问题?

I am using OMNeT 5.6.2 and Matlab 2020a under Windows我在 Windows 下使用 OMNeT 5.6.2 和 Matlab 2020a

The code for my module is我的模块的代码是

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

The message indicates that the error occurred during the startup of the process.该消息表明错误发生在进程启动期间。 It means that the process probably cannot load the Matlab runtime DLL.这意味着该进程可能无法加载 Matlab 运行时 DLL。 The directories where the Matlab DLLs reside must be present on the system path so the operating system can load them. Matlab DLL 所在的目录必须存在于系统路径上,以便操作系统可以加载它们。 On Windows it is especially hard to avoid DLL hell and fix these issues (mostly because of the lack of proper error messages).在 Windows 上,尤其难以避免 DLL 地狱并修复这些问题(主要是因为缺少适当的错误消息)。 First, I would try to start the example from the MinGW env command prompt where you can control the PATH manually and try to run from the IDE only after it works in the command line.首先,我将尝试从 MinGW env 命令提示符启动示例,您可以在其中手动控制 PATH 并尝试仅在 IDE 在命令行中运行后从它运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM