我的想法是檢查這個DLL是否有我需要的版本,或者它是更舊還是更新? 我正在嘗試使用THUNK/Trampoline功能。轉換無效gcc -fpermissive
這裏是我在不同的* .dll文件中的用法。
int FilterVersion(CBaseFilter* pFilter)
{
//this is line 178
void* ProgVersion = (CBaseFilter::AbstractProgVersion)(void *)&CBaseFilter::FilterVersionStatic;
return (*(CBaseFilter::AbstractProgVersion)ProgVersion)(*pFilter);
}
這是我宣佈蹦牀的類的聲明。
class PROG_CORE_API CBaseFilter
{
friend class CProgEngineInternal;
// Trampoline Design pattern
// this FilterVersion function will be used on a global function exported from a
// cpp file exporting the dlls functions (therfore must be: static = global).
// it will use an arbitrary BaseFilter object - so Pure abstract function will
// make it possible to use polimorphism to all types of derived classes objects.
public:
typedef int (*AbstractProgVersion)(CBaseFilter&);
virtual int FilterVersionAbs() =0 ;
// a single spot (static) where all derived implemented filters versions tested.
// developer can specify version numbers to prohibit from running
// returning 0 should block the filter from loading.
static int FilterVersionStatic(CBaseFilter& FilterObj)
{
// version is 4 bytes
return FilterObj.FilterVersionAbs();
}
mutable int m_Version;
private:.....
我得到的警告是:
GCC Build Error in - AddBorders_F.cpp:178:76: error: invalid conversion from ‘CBaseFilter::AbstractProgVersion {aka int (*)(CBaseFilter&)}’ to ‘void*’ [-fpermissive]
GCC Build Error in - AddBorders_F.o] Error 1
GCC Build Error in - make: *** [AddBorders] Error 2
至於我的搜索去我明白我缺少一個鑄件,但我不明白爲什麼?
線178在哪裏? – ldrumm
這裏的第一行是我的用法void * ProgVersion =(CBaseFilter :: AbstractProgVersion)(void *)&CBaseFilter :: FilterVersionStatic; – Gilad
這將有助於添加註釋到相關的源代碼行,以顯示哪一行是第178行。您應該編輯您的問題以顯示此內容。 – ldrumm