我認爲這是一個微不足道的問題,但我永遠無法得到它的工作!初始化函數C庫外的.lib指針的外部指針
我已經通過.lib中的函數指針進行函數調用,並將.lib附加到應用程序,該應用程序在庫外設置函數指針。以下是代碼片段
庫:
void (*PopulateBuffer)(byte *NALBuffer,unsigned int *readbytes); // The Declaration
PopulateBuffer(NALBuffer,&readbytes); // The function Call
應用:
extern void (*PopulateBuffer)(char *NALBuffer,unsigned int *readbytes);
void UpdateNALBuff(char *Buffer,unsigned int *readbytes)
{
//Buffer content is updated
//readbytes is updated
}
main()
{
PopulateBuffer= &UpdateNALBuff;
LibMain(); // this is the main call in which the function pointer is called
}
我這樣做嗎???當過函數調用庫中的方法,它拋出我下面的錯誤 原因:DecoderTestApp.exe在0x00536e88
未處理的異常:0000005:訪問衝突讀取位置0x7ffef045。
該庫是靜態的,而不是.dll – 2012-08-14 11:26:32
它是否無法使用指針或在函數內調用函數? – Rohan 2012-08-14 11:28:27
它在函數調用時失敗,而不是函數內部我已經在函數內部放置了一個斷點,並且它沒有達到那個點,我在函數調用 – 2012-08-14 11:32:46