Jul 6, 2018 at 7:34am UTC
I use MFC C++ project.
I need to use IMSApiCLib.dll .
I try "imsapiGetLibraryVersion" function.
But it could not load success.
Please help me check.
thanks.
[Code]
---------- main.cpp ----------
#include <stdio.h>
extern "C" {
#include "IMSApiCLib.h"
}
int main() {
IMSAPIUTF8STRING version = NULL;
imsapiGetLibraryVersion(&version);
getchar();
return 0;
}
---------- IMSApiCLib.h ----------
#ifndef __IMSAPICLIB_H
#define __IMSAPICLIB_H
#ifdef __cplusplus
extern "C" {
#endif
#define IMSAPIVERSION "name=[IMSApiCLib] version=[8.00.00-1] buildtime=[2014-08-29 17:13:02]"
#undef WINDOWS
#undef LINUX
#include <wchar.h>
#ifndef __cdecl
#define __cdecl
#endif
.
..
...
....
/* definition of fix functions */
IMSAPILONG __cdecl imsapiInit(IMSAPIUTF8STRING anOptionsFilePath, IMSAPISTRING* jvmArguments);
IMSAPILONG __cdecl imsapiGetLibraryVersion(IMSAPIUTF8STRING* versionString);
.
..
...
....
#ifdef __cplusplus
}
#endif
#endif
[error]
Error 3 error LNK1120: 1 unresolved externals E:\Desktop\DynamicSrc\Debug\AddDynamic.exe 1
Error 2 error LNK2019: unresolved external symbol _imsapiGetLibraryVersion referenced in function _main E:\Desktop\DynamicSrc\AddDynamic\main.obj
I also use
--> HINSTANCE handler = LoadLibrary(L"IMSApiCLib.dll");
but it could not work.
Jul 6, 2018 at 9:39am UTC
You've specified the DLL to load at run time, but not what to link against at build time so the build fails.
try using #import <IMSApiCLib.dll>
I tend to put it in stdafx.h
Jul 7, 2018 at 10:52am UTC
thanks Jaybob66
I set visual studio properity add IMSApiCLib.dll .
It also work.
thank you.