Feeling is pData1 and pOut1 form right? But I don't know how to change, never understand pointer
The third party to provide the barcode. DLL files, def file is:
The LIBRARY barcode
EXPORTS
Encode @ 1
Decode @ 2
Now I'd like to call these two functions, but it is always a problem, UCHAR inside each other with a header file is unsigned char,
# include "PCH. H"
#include
#include
# include "bar_cfg. H"
# include "bar_def. H"
# include "bar_err. H"
# include "bar_type. H"
# pragma comment (lib, "barcode. Lib")
_declspec (dllimport) LONG decode (UCHAR * pData, UCHAR * pOut);
_declspec (dllimport) LONG encode (UCHAR * pData, UCHAR * pOut);
Int main ()
{
UCHAR pData1 [28]="12345678901234567890123456";
UCHAR pOut1 [400]="";
LONG rc=encode (pData1 pOut1);
STD: : cout & lt; <"Encode \ n";
STD: : cout & lt;STD: : cout & lt; <"\ n";
STD: : cout & lt;STD: : cout & lt; <"\ n";
}
Compile error message:
Severity code shows the project file line prohibits display status
Error LNK2019 cannot resolve the external symbol "__declspec (dllimport) long __cdecl encode (unsigned char *, unsigned char *)" (__imp_? Encode @ @ YAJPAE0 @ Z), the symbol referenced in the function _main barcode_test C: \ documents \ Workspace \ ykzx - barcode \ barcode_test \ barcode_test \ barcode_test obj 1
Error LNK2019 cannot resolve the external symbol "__declspec (dllimport) long __cdecl decode (unsigned char *, unsigned char *)" (__imp_? Decode @ @ YAJPAE0 @ Z), the symbol referenced in the function _main barcode_test C: \ documents \ Workspace \ ykzx - barcode \ barcode_test \ barcode_test \ barcode_test obj 1
Dumpbin. Exe/exports barcode. DLL
The Dump of file barcode_test \ barcode_test \ barcode DLL
The File Type: DLL
Section contains the following exports for barcode. DLL
Characteristics of 00000000
FFFFFFFF time date stamp
0.00 version
1 the ordinal base
2 number of functions provides
2 the number of names
The ordinal hint RVA name
2 0 000018 d0 decode=_decode
1 1 00001950 encode=_encode
The Summary
3000. The data
1 d000. Rdata
5000. Reloc
1000. The RSRC
76000. The text
CodePudding user response:
Because you don't have to generate barcode. LibCommand line perform:
Lib/def: def file name/out: output library file name/machine: corresponding 32/64 bit Intel x86 or x64 architecture
CodePudding user response: