Main Content

ファイル構造とパスの設定

コンパイル パスの検索順序

fiaccel は、まずコード生成パス、次に MATLAB® パスを検索して、関数の呼び出しを解決します。既定の設定では、fiaccel はパス上で見つかった関数用のコードをコンパイルし、生成しようとします (外部関数であることを明示的に宣言した場合を除く)。"外部関数" は、MATLAB パス上に存在する関数であり、実行のために MATLAB ソフトウェアに送信されます。fiaccel では、外部関数のコンパイルは行われず、MATLAB に送信して実行されます。

命名規則

MATLAB では、関数と生成ファイルの命名規則に従わなければなりません。

予約された接頭辞

MATLAB では、接頭辞 eml がグローバルな C 関数と生成コード内の変数用に予約されています。たとえば、ランタイム ライブラリ関数名はすべて接頭辞 emlrt から始まります (emlrtCallMATLAB など)。名前の競合を避けるために、C 関数または主要な MATLAB 関数の名前には接頭辞 eml を付けないでください。

予約キーワード

MATLAB Coder™ ソフトウェアは、ソフトウェアが独自に使用するワードを生成コード言語のキーワードとして予約します。MATLAB Coder のキーワード MATLAB Coder ソフトウェア内部で使用するために予約されているので、MATLAB コード内で識別子や関数名として使用しないでください。また、C の予約キーワードも MATLAB コード内で識別子または関数名として使用しないでください。コード ジェネレーターが名前を変更できない予約キーワードが MATLAB コードに含まれている場合、コード生成ビルドは完了せず、エラー メッセージが表示されます。このエラーに対処するには、予約されていない識別子または名前を使用するようにコードを変更します。

さらに、MATLAB Coder ソフトウェアで C++ コードを生成する場合は、MATLAB コードにC++ の予約キーワードを含めないでください。

C の予約キーワード

assertexternsetjmpstring
autofenvshortstruct
breakfloatsignalswitch
caseforsignedtgmath
chargotosizeofthreads
constifstatictime
complexintstdaligntypedef
continueinttypesstdarguchar
ctypeiso646stdatomicunion
defaultlimitsstdboolunsigned
dolocalestddefvoid
doublelongstdintvolatile
elsemathstdiowchar
enumregisterstdlibwctype
errnoreturnstdnoreturnwhile

C++ の予約キーワード

algorithmcstddefiostreamsstream
anycstdintistreamstack
arraycstdioiteratorstatic_cast
atomiccstdliblimitsstdexcept
bitsetcstringliststreambuf
cassertctgmathlocalestring_view
catchctimemapstrstream
ccomplexcucharmemorysystem_error
cctypecwcharmemory_resourcetemplate
cerrnocwctypemutablethis
cfenvdeletemutexthread
cfloatdequenamespacethrow
chronodynamic_castnewtry
cinttypesexceptionnumerictuple
ciso646executionoperatortypeid
classexplicitoptionaltype_traits
climitsexportostreamtypeindex
clocalefilesystemprivatetypeinfo
cmathforeward_listprotectedtypename
codecvtfriendpublicunordered_map
complexfstreamqueueunordered_set
condition_variablefunctionalrandomusing
const_castfutureratioutility
csetjmpinitializer_listregexvalarray
csignalinlinereinterpret_castvector
cstdaligniomanipscoped_allocatorvirtual
cstdargiossetwchar_t
cstdbooliosfwdshared_mutex 

コード生成用の予約キーワード

absfortranlocalZCErtNaN
asmHAVESTDIOlocalZCSVSeedFileBuffer
boolid_tmatrixSeedFileBufferLen
boolean_Tint_TMODELsingle
byte_T int8_TMTTID01EQ
char_Tint16_TNCSTATEStime_T
cint8_Tint32_TNULLtrue
cint16_Tint64_TNUMSTTRUE
cint32_TINTEGER_CODEpointer_Tuint_T
creal_TLINK_DATA_BUFFER_SIZEPROFILING_ENABLED uint8_T
creal32_TLINK_DATA_STREAMPROFILING_NUM_SAMPLESuint16_T
creal64_TlocalBreal_Tuint32_T
cuint8_TlocalCreal32_Tuint64_T
cuint16_TlocalDWorkreal64_TUNUSED_PARAMETER
cuint32_TlocalPRTUSE_RTMODEL
ERTlocalXRT_MALLOC VCAST_FLUSH_DATA
falselocalXdisrtInfvector
FALSElocalXdotrtMinusInf 

生成ファイルの命名規則

MATLAB では、MEX ファイルに対してプラットフォーム固有の拡張子があります。

プラットフォームMEX ファイルの拡張子
Linux® x86-64.mexa64
Windows® (32 ビット).mexw32
Windows x64.mexw64