J Collins
J Collins

Reputation: 2170

Is it possible to access DLLs generated with RTW in MATLAB?

Given a DLL compiled using Real Time Workshop, is it possible to then take that DLL and address it using for instance the loadlibrary() function?

Attempts to-date have yielded that the DLL 'is not a valid Win32 application.'

Upvotes: 0

Views: 164

Answers (1)

am6sigma
am6sigma

Reputation: 184

What you can do is, generate the code, write wrappers for it and create a DLL in and IDE. For example if you wanted to create a dll in visual studio, you would generate your code, and then import all of the files in the code generation report.

a. generate code using ert.tlc "Create Visual C/C++ Solution File for the realtime Workshop embedded Coder"

Set up your project paths as follows:

    b. Source Files
        ModelName.c/cpp 
        ModelName_data.c/cpp
        ert_main.c/cpp
        ModelName.h
        ModelName_private.h
        ModelName_types.h
        rtwtypes.h
    c. Include director paths
        $(MATLAB_ROOT)\simulink\include
        $(MATLAB_ROOT)\extern\include
        $(MATLAB_ROOT)\rtw\c\src
        $(MATLAB_ROOT)\rtw\c\src\ext_mode\common

Good tutorial for creating dlls MSDN

http://msdn.microsoft.com/en-us/library/ms235636.aspx

I am running MatLab 2010, and visual studio 2010.

Upvotes: 1

Related Questions