开发者

Calling to an EXE function from inside a DLL

开发者 https://www.devze.com 2023-02-08 19:02 出处:网络
I need to call to SEVERAL functions that are inside the EXE from a DLL location. And, I also will need to access some of the variables found inside the EXE from the DLL. Below is the error list, proba

I need to call to SEVERAL functions that are inside the EXE from a DLL location. And, I also will need to access some of the variables found inside the EXE from the DLL. Below is the error list, probably not helpful at all, but attached it anyway. I did the opposite (exe->dll) by using .def files and dllimport and additional dependencies. And, now I am stuck needing to the other way around. note: Micros*t Visual Studio 2008 pro, Standard-C.

3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _SV_GentityNum が関数 _SV_BotAllocateClient で参照されました。
3>sv_bot.obj : error LNK2001: 外部シンボル "_svs" は未解決です。
3>sv_bot.obj : error LNK2001: 外部シンボル "_sv_maxclients" は未解決です。
3>sv_bot.obj : error LNK2001: 外部シンボル "_botlib_export" は未解決です。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _Cvar_Get が関数 _BotDrawDebugPolygons で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _SV_Trace が関数 _BotImport_Trace で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _SV_ClipToEntity が関数 _BotImport_EntityTrace で参照されました。
3>sv开发者_开发问答_bot.obj : error LNK2019: 未解決の外部シンボル _SV_PointContents が関数 _BotImport_PointContents で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _SV_inPVS が関数 _BotImport_inPVS で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _CM_EntityString が関数 _BotImport_BSPEntityData で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _CM_ModelBounds が関数 _BotImport_BSPModelMinsMaxsOrigin で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _CM_InlineModel が関数 _BotImport_BSPModelMinsMaxsOrigin で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _Z_TagMalloc が関数 _BotImport_GetMemory で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _Z_Free が関数 _BotImport_FreeMemory で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _Hunk_Alloc が関数 _BotImport_HunkAlloc で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _Hunk_CheckMark が関数 _BotImport_HunkAlloc で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _SV_ExecuteClientCommand が関数 _BotClientCommand で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _VM_Call が関数 _SV_BotFrame で参照されました。
3>sv_bot.obj : error LNK2001: 外部シンボル "_gvm" は未解決です。
2>   ライブラリ ..\..\build\quake3_release\ioquake3.lib とオブジェクト ..\..\build\quake3_release\ioquake3.exp を作成中
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _GetBotLibAPI が関数 _SV_BotInitBotLib で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _FS_Seek が関数 _SV_BotInitBotLib で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _FS_FCloseFile が関数 _SV_BotInitBotLib で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _FS_Write が関数 _SV_BotInitBotLib で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _FS_Read2 が関数 _SV_BotInitBotLib で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _FS_FOpenFileByMode が関数 _SV_BotInitBotLib で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _Z_AvailableMemory が関数 _SV_BotInitBotLib で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _Z_Malloc が関数 _SV_BotInitBotLib で参照されました。
3>sv_bot.obj : error LNK2019: 未解決の外部シンボル _Cvar_VariableIntegerValue が関数 _SV_BotInitBotLib で参照されました。
3>..\..\build\game_release\qagamex86.dll : fatal error LNK1120: 外部参照 28 が未解決です。
2>LINK : warning LNK4098: defaultlib 'LIBCMT' は他のライブラリの使用と競合しています。/NODEFAULTLIB:library を使用してください。
3>ビルドログは "file://c:\Documents and Settings\yasir\デスクトップ\ioquake3dev\ioquake3dev - sandbox\build\game_release\BuildLog.htm" に保存されました。
3>game - エラー 29、警告 0
2>LINK : warning LNK4199: /DELAYLOAD:OleAcc.dll は無視されます。OleAcc.dll にインポートがありません。
2>cm_patch.obj : error LNK2019: 未解決の外部シンボル _BotDrawDebugPolygons が関数 _CM_DrawDebugSurface で参照されました。
2>sv_client.obj : error LNK2019: 未解決の外部シンボル _SV_BotFreeClient が関数 _SV_DropClient で参照されました。
2>sv_game.obj : error LNK2001: 外部シンボル "_SV_BotFreeClient" は未解決です。
2>sv_game.obj : error LNK2019: 未解決の外部シンボル _SV_BotGetConsoleMessage が関数 _SV_GameSystemCalls で参照されました。
2>sv_game.obj : error LNK2019: 未解決の外部シンボル _SV_BotGetSnapshotEntity が関数 _SV_GameSystemCalls で参照されました。
2>sv_game.obj : error LNK2019: 未解決の外部シンボル _SV_BotLibShutdown が関数 _SV_GameSystemCalls で参照されました。
2>sv_game.obj : error LNK2019: 未解決の外部シンボル _SV_BotLibSetup が関数 _SV_GameSystemCalls で参照されました。
2>sv_game.obj : error LNK2019: 未解決の外部シンボル _BotImport_DebugPolygonDelete が関数 _SV_GameSystemCalls で参照されました。
2>sv_game.obj : error LNK2019: 未解決の外部シンボル _BotImport_DebugPolygonCreate が関数 _SV_GameSystemCalls で参照されました。
2>sv_game.obj : error LNK2019: 未解決の外部シンボル _SV_BotAllocateClient が関数 _SV_GameSystemCalls で参照されました。
2>sv_game.obj : error LNK2001: 外部シンボル "_bot_enable" は未解決です。
2>sv_init.obj : error LNK2019: 未解決の外部シンボル _SV_BotFrame が関数 _SV_SpawnServer で参照されました。
2>sv_main.obj : error LNK2001: 外部シンボル "_SV_BotFrame" は未解決です。
2>sv_init.obj : error LNK2019: 未解決の外部シンボル _SV_BotInitBotLib が関数 _SV_Init で参照されました。
2>sv_init.obj : error LNK2019: 未解決の外部シンボル _SV_BotInitCvars が関数 _SV_Init で参照されました。
2>..\..\build\quake3_release\ioquake3.exe : fatal error LNK1120: 外部参照 13 が未解決です。
2>ビルドログは "file://c:\Documents and Settings\yasir\デスクトップ\ioquake3dev\ioquake3dev - sandbox\build\quake3_release\BuildLog.htm" に保存されました。
2>quake3 - エラー 16、警告 2
========== ビルド: 0 正常終了、2 失敗、2 更新不要、1 スキップ ==========


I think you cannot link the DLL to your EXE. Instead define a struct which contains function pointers and initialize an instance of this struct in your exe. Assingn the pointers to your functions to the pointers in your struct instance. Call a DLL function to store a pointer to the struct instance in a static variable of your DLL. Whenever your DLL wants to call a EXE-function call this function using a function pointer from the struct instance.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号