Home > Back-end >  What should the DLL function call?
What should the DLL function call?

Time:09-20

Not really familiar with c + +, some dizzy,
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. Lib
Command 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:

reference 1/f, play big shoot early nuclear response:
because you don't have to generate barcode. The lib
Command line perform:
Lib/def: def file name/out: output library file name/machine: corresponding 32/64 bit Intel x86 or x64 architecture


This line not line?
# pragma comment (lib, "barcode. Lib")

CodePudding user response:

reference 1/f, play big shoot early nuclear response:
because you don't have to generate barcode. The lib
Command line perform:
Lib/def: def file name/out: output library file name/machine: corresponding 32/64 bit Intel x86 or x64 architecture


The other party provides barcode. Lib, has been in the source directory, and added to the project,

CodePudding user response:

Use lib command to generate the barcode. Lib, is still the same error,

CodePudding user response:

_declspec (dllimport) LONG __cdecl decode (UCHAR * pData, UCHAR * pOut);
_declspec (dllimport) LONG __cdecl encode (UCHAR * pData, UCHAR * pOut);

CodePudding user response:

reference 5 floor early play the play nuclear war response:
_declspec (dllimport) LONG __cdecl decode (UCHAR * pData, UCHAR * pOut);
_declspec (dllimport) LONG __cdecl encode (UCHAR * pData, UCHAR * pOut);


Is still the same error
  • Related