[問題] BCB 6 動態連結dll問題

看板C_and_CPP (C/C++)作者時間11年前 (2015/04/14 23:55), 編輯推噓1(103)
留言4則, 2人參與, 最新討論串1/1
開發平台(Platform): bcb 6.0 in Windows XP 額外使用到的函數庫(Library Used): No 問題(Question):我使用bcb開發一個dll library和一個tool去使用自已寫的dll檔, 但是發現我在call dll的function的時候(代入很多指標的參數),發現在執行完 function後,有些指標的address會變動到,但function內其實根本沒動到,不懂為何會被 更改到。 餵入的資料(Input): uStatus = SetCardMode(&uhndlDrive,upDriveSettingTable,upParamTable,upStatus); 其中SetCardMode是dll function,其他參數如upDriveSettingTable,upParamTable,upStatus 都是unsigned char *型別。 預期的正確結果(Expected Output): call此function後其實是想修改upParamTable這個array的值,但現在只是空function,即 沒做任何事情就跳出去,但一出function後我的upParamTable的address就被改掉了。 錯誤結果(Wrong Output): 在call此function前的upParamTable Address為42118232,一做完些function就變成1900。 程式碼(Code):(請善用置底文網頁, 記得排版) upParamTable = new BYTE[cParamTableSecCnt*cSingleSectorByte]; uStatus = SetCardMode(&uhndlDrive,upDriveSettingTable,upParamTable,upStatus); 大概就這樣,SetCardMode是dll function 補充說明(Supplement): dll function是使用動態連結的方式。不知道跟這個有沒有關係。 麻煩各位如果有想法可以告知一下嗎? 謝謝各位大大^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.120.188.226 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1429026915.A.A3E.html

04/15 02:37, , 1F
資訊不夠,無法判斷
04/15 02:37, 1F

04/15 02:48, , 2F
前後程式碼、DLL function原型宣告、引用方式、哪一
04/15 02:48, 2F

04/15 02:48, , 3F
行之後出問題都提供才知道
04/15 02:48, 3F

04/15 06:34, , 4F
prgma 1@.@?
04/15 06:34, 4F
文章代碼(AID): #1LBJXZe- (C_and_CPP)
文章代碼(AID): #1LBJXZe- (C_and_CPP)