日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > php >内容正文

php

php调用dll函数,[转载]matlab调用DLL中的函数

發(fā)布時(shí)間:2025/4/17 php 73 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php调用dll函数,[转载]matlab调用DLL中的函数 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

首先,這種調(diào)用在 Matlab 的幫助文檔中有說明。它的英文名稱為:

MATLAB Interface to Generic

DLLs

從這個(gè)幫助文檔,我們不難看出,整個(gè)過程為:加載

DLL ,調(diào)用相關(guān)函數(shù),和卸載 DLL 。

看起來簡單,但是在實(shí)際操作中遇到了如下幾個(gè)問題:

1,

loadlibrary 出錯(cuò)。錯(cuò)誤報(bào)告為:

Error using ==>

loadlibrary Failed to preprocess input file. Output from

preprocessor is: 'c:program' is not recognized as an internal or

external command, operable or batch file

錯(cuò)誤的原因很簡單,就是 loadlibrary 的問題。由于你的 matlab 是安裝在 C:program

file 目錄下,中間有一個(gè)空格。所以出錯(cuò)了。這在

Matlab R14sp2

及其以前的版本都有這個(gè)問題。

解決辦法:

-

重新安裝 matlab ,換一個(gè)目錄,中間不帶空格。

modify

line 168 of loadlibrary.m in

toolboxmatlabgeneral from:

cc=[lcc ' -noregistrylookup'

ccinclude ' -E "' header '"'];

to:

cc=['"' lcc '"

-noregistrylookup' ccinclude ' -E "' header '"']; If your header

has #include statements, then it might also be necessary to modify

the following lines:

line 106 from:

ccinclude = [ccinclude ' -I '

fullfile(matlabroot, 'extern','include')];

to:

ccinclude = [ccinclude ' -I "'

fullfile(matlabroot,'extern','?include"')];

line 166 from:

ccinclude = [ccinclude ' -I '

fullfile(matlabroot,'sys',...

'lcc','include')];

to:

ccinclude = [ccinclude ' -I "'

fullfile(matlabroot,'sys',...

'lcc','include"')];

The line numbers might be

different in previous releases, but the changes are the

same

注意:千萬注意其中的空格。否則, matlab 告訴出錯(cuò),可不要撓頭。

2,

loadlibrary 成功了。但是查詢 libfunctions 或卸載 unloadlibrary 不成功。

怪了。我仔細(xì)看了看 loadlibrary 中的頭文件。由于我寫 DLL 的時(shí)候提供的頭文件是給 VC 用的,所以其中有些是 VC 環(huán)境中自定義的東西。我把這個(gè)頭文件改了改,把

DLL 相關(guān)的部分給注釋掉,如:

#ifdef

DATATRANSFER_API

//#define DATATRANSFER_API

extern "C" __declspec(dllexport)

#else

#define DATATRANSFER_API extern

"C" __declspec(dllimport)

#endif

//DATATRANSFER_API

int

GYZPrepare(void);

如上面,把這個(gè) DLL 相關(guān)的注釋掉,就剩下一個(gè)簡單的 .h 文件。呵呵,這樣就通過了。

3,

參數(shù)傳遞。

由于我的程序很簡單,所以就不管這些啦。

總結(jié)

以上是生活随笔為你收集整理的php调用dll函数,[转载]matlab调用DLL中的函数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。