5
I am creating a DLL that needs to export 11 CEN/XFS functions, but there is a function that consumes a header file. I think the mistake is in consuming a method from a header that is not stated in my scope, someone to help ?
This dll will communicate with XFS Manager.
My code is this (My DLL - dllmain.cpp):
HRESULT WINAPI WFPOpen ( HSERVICE hService, LPSTR lpszLogicalName, HAPP hApp, LPSTR lpszAppID, DWORD dwTraceLevel, DWORD dwTimeOut, HWND hWnd, REQUESTID ReqID, HPROVIDER hProvider, DWORD dwSPIVersionsRequired, LPWFSVERSION lpSPIVersion, DWORD dwSrvcVersionsRequired, LPWFSVERSION lpSrvcVersion)
{
printf("INTO WFPOpen");
WFSRESULT * lpWFSResult;
HRESULT result;
SYSTEMTIME st;
HRESULT rt;
GetSystemTime(&st);
//o erro ocorre aki
result = WFMAllocateBuffer(sizeof(WFSRESULT), WFS_MEM_ZEROINIT, (void**)&lpWFSResult);
if(result!=WFS_SUCCESS){
return WFS_ERR_INTERNAL_ERROR;
}
return WFS_SUCCESS;
}
Header file (XFSADMIN. H):
HRESULT extern WINAPI WFMAllocateBuffer(ULONG ulSize, ULONG ulFlags, LPVOID * lppvData);
My dll. h (11 methods that will be exported)
class DLLIMPORT DllClass
{
public:
HRESULT WINAPI WFPCancelAsyncRequest (HSERVICE hService, REQUESTID RequestID);
HRESULT WINAPI WFPClose (HSERVICE hService, HWND hWnd, REQUESTID ReqID);
HRESULT WINAPI WFPDeregister (HSERVICE hService, DWORD dwEventClass, HWND hWndReg, HWND hWnd, REQUESTID ReqID);
HRESULT WINAPI WFPExecute (HSERVICE hService, DWORD dwCommand, LPVOID lpCmdData, DWORD dwTimeOut, HWND hWnd, REQUESTID ReqID);
HRESULT WINAPI WFPGetInfo (HSERVICE hService, DWORD dwCategory, LPVOID lpQueryDetails, DWORD dwTimeOut, HWND hWnd, REQUESTID ReqID);
HRESULT WINAPI WFPLock (HSERVICE hService, DWORD dwTimeOut, HWND hWnd, REQUESTID ReqID);
HRESULT WINAPI WFPOpen (HSERVICE hService, LPSTR lpszLogicalName, HAPP hApp, LPSTR lpszAppID, DWORD dwTraceLevel, DWORD dwTimeOut, HWND hWnd, REQUESTID ReqID, HPROVIDER hProvider, DWORD dwSPIVersionsRequired, LPWFSVERSION lpSPIVersion, DWORD dwSrvcVersionsRequired, LPWFSVERSION lpSrvcVersion);
HRESULT WINAPI WFPRegister (HSERVICE hService, DWORD dwEventClass, HWND hWndReg, HWND hWnd, REQUESTID ReqID);
HRESULT WINAPI WFPSetTraceLevel (HSERVICE hService, DWORD dwTraceLevel);
HRESULT WINAPI WFPUnloadService ();
HRESULT WINAPI WFPUnlock (HSERVICE hService, HWND hWnd, REQUESTID ReqID);
};
However this error occurs when compiling the DLL.
More precisely here:
$(CPP) -shared $(LINKOBJ) -o $(BIN) $(LIBS) -Wl,--output-def,$(DEF),--out- implib,$(STATIC),--add-stdcall-alias
should be missing a lib in your project, maybe xfs_supp.lib
– zentrunix
and where should I put ? at the root of the project I have tried and did not help.
– Matheus Cardozo
that is missing a lib from XFS is practically right, and this lib "xfs_supp.lib" exports the function that is missing (Wfmaallocatebuffer)...you must set this lib as input in the link step of the build process dll...more than that can’t be said, without knowing the project
– zentrunix
If I e-mail you what I am doing, could I have a look ? because I need to export this dll just for testing.
– Matheus Cardozo
put more information about the project right here...other people will be able to look
– zentrunix
I put more information.
– Matheus Cardozo
you are using mingw or Cygwin (or something like that), does XFS libs work in that environment ? that I don’t know... anyway, looking at the link-editing line, is that in "$(LIBS)" the names of all the necessary libs ? Something else, this here "-Wl,-output-def,$(DEF),--out-implib,$(STATIC),-add-stdcall-alias" is weird, that space between "--out- implib" is just like that? Shouldn’t there be a comma in there ? I’m guessing here, but the suboptions of a "-Wl" option should be separated by a comma, not by space
– zentrunix
Have you tried
#pragma comment(lib, "xfs_supp.lib")
in hisdllmain.cpp
?– snoopy