c風格命名和c++命名

來源:互聯網
上載者:User

今天在提問裡問了幾個大牛一個問題,大牛們說得很深,我的資質有很淺,沒辦法,我只能自己琢磨了啊,下面是正題


 

//////////////////////////////////////////////////////////////////////////////////////////

7C9211FF  test        byte ptr [esi+10h],10h
7C921203  je          7C92FEF6
7C921209  pop         esi 
7C92120A  leave           
7C92120B  ret         4   
7C92120E  int         3   //這裡是斷點,
7C92120F  ret             
7C921210  mov         edi,edi
7C921212  int         3   
7C921213  ret             
7C921214  mov         edi,edi
7C921216  mov         eax,dword ptr [esp+4]
7C92121A  int         3   
7C92121B  ret         4   
7C92121E  mov         eax,dword ptr fs:[00000018h]
7C921224  ret             
7C921225  push        edi 
7C921226  mov         edi,dword ptr [esp+0Ch]
7C92122A  mov         edx,dword ptr [esp+8]
7C92122E  mov         dword ptr [edx],0
7C921234  mov         dword ptr [edx+4],edi

以上是發彙編代碼,當時不知道咋回事,大牛們建議用TRY,但是試了很多次,都失敗了(其實是我不會用try所致),無賴自己琢磨設斷點,發現是自己調用的DLL出問題了,真奇怪,與使用vs的命令提示字元去檢查DLL,結果發現是對的,一切正常,而後開啟該函數源檔案,發現如下代碼:

 

 

//
// MATLAB Compiler: 4.0 (R14)
// Date: Mon Aug 30 14:16:33 2010
// Arguments: "-B" "macro_default" "-W" "cpplib:libMyAdd" "-T" "link:lib"
// "filtertemp"
//

#ifndef __libmyadd_h
#define __libmyadd_h 1

#if defined(__cplusplus) && !defined(mclmcr_h) && defined(__linux__)
#  pragma implementation "mclmcr.h"
#endif
#include "mclmcr.h"
#include "mclcppclass.h"
#ifdef __cplusplus
extern "C" {
#endif

extern bool libMyAddInitializeWithHandlers(mclOutputHandlerFcn error_handler,
                                           mclOutputHandlerFcn print_handler);
extern bool libMyAddInitialize();
extern void libMyAddTerminate();

extern void mlxFiltertemp(int nlhs, mxArray *plhs[],
                          int nrhs, mxArray *prhs[]);

#ifdef __cplusplus
}
#endif

#ifdef __cplusplus

extern void filtertemp(int nargout, mwArray& y
                       , const mwArray& AD0, const mwArray& AD1);

#endif

#endif

 

 

///////////////////////////////////////////////////

怎麼會這樣啊??仔細想想才發現:libmyaddinitialize()是編譯成c風格的了(加—底線的),而我的編譯器是vs,c++風格的(加奇怪符號的,),這就對了,將其注釋不要,果然對了,,,,,但是很不辛,因為這個函數對於我調用的DLL進行了一些初始化,在我把它注釋後發現,出現了記憶體不能讀的現象,真的是兩為其難啊,.....這是個棘手的問題。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.