Home > Back-end >  About XXX. The problem of lib introduction of call
About XXX. The problem of lib introduction of call

Time:10-09

H header file.
# # ifndef _ILBC_H
# define _ILBC_H

# include & lt; Mmsystem. H>
//macro definition, if the system didn't declare WINAPI, is declared, it is a standard _stdcall invocation style
# # ifndef WINAPI
# define WINAPI _stdcall
# endif

//////////////////////////////////////////

# ifdef __iLBC_DLL_IMPORT

# include "iLBC_encode. H"
# include "iLBC_decode. H"

ILBC_Enc_Inst_t iLBCenc_inst;
ILBC_Dec_Inst_t iLBCdec_inst;

# define iLBC_API (type, name, args) \
Extern "C" type __declspec (dllexport) WINAPI name args.
# the else
# define iLBC_API (type, name, args) \
Extern "C" type __declspec (dllimport) WINAPI name args.
# endif

///////////////////////////////////////////////////////////////////
ILBC_API (bool, ilbc_init, ());
ILBC_API (int, ilbc_encoder, (short * pin, unsigned char * pout));
ILBC_API (int, ilbc_decoder, (unsigned char * pin, short * pout));

# endif


Key code CPP file
BOOL APIENTRY DllMain (HANDLE hModule, dwords ul_reason_for_call LPVOID lpReserved)
{
.//code
return TRUE;
}
Bool WINAPI ilbc_init ()
{
.
}
Int WINAPI ilbc_encoder (short * pin, unsigned char * pout)
Int WINAPI ilbc_decoder (unsigned char * pin, short * pout)


Generate a lib and a DLL
I opened another DLL project to introduce the lib after introduction, what should call?
I am a c + + white to find more information or do not understand, you great god, beg to solve!

Or you can give me a direct call iLBC. Lib also tell me how to use!
The last 30 points, to solve!

CodePudding user response:

Exe DLL in the same folder
Lib to try to introduce in the compiler
Point file to expand into the function called statement or directly include your export function. H file

CodePudding user response:

. Libraries (lib) is divided into two kinds, one kind is a dynamic library (DLL) import libraries, one is static library (including implementation), it seems that you use is the first,

Then in your Project, contains the lib library after the corresponding header file, put the lib files are added to the Project can directly use the functions (Project - & gt; Add to the project)

CodePudding user response:

# include "iLBC. H"
# pragma link "iLBC. Lib//with this line, is to tell the link, link to join iLBC. The lib, the lib files are added to the engineering effect is the same,

CodePudding user response:

The
reference 3 floor PPower response:
# include "iLBC. H
"# pragma link "iLBC. Lib//with this line, is to tell the link, link to join iLBC. The lib, the lib files are added to the engineering effect is the same,

# include "ilbc. H"
Lib, I am in the project properties reference entered,

Doing so will report errors,
Error 2 error LNK2019: cannot resolve the external symbol of __imp__ilbc_encoder @ 8, the symbol in the function "protected: void __thiscall CRecodeSound: : OnSoundData (unsigned int, long)" (? OnSoundData @ CRecodeSound @ @ IAEXIJ @ Z) cited in E: \ 1. Learning WPF instances \ VideoCapture \ VideoCapture \ RecodeSound obj VideoCapture

Error 1 error LNK2019: cannot resolve the external symbol of __imp__ilbc_init @ 0, the symbol in the function "public: __thiscall CRecodeSound: : CRecodeSound (class CDialog *)" (?????? 0 crecodesound @ @ QAE @ PAVCDialog @ @ @ Z) cited in E: \ 1. Learning WPF instances \ VideoCapture \ VideoCapture \ RecodeSound obj VideoCapture

CodePudding user response:

I wonder why is it an error,
I have seen a information, said there is what might be the runtime compilation method caused by inconsistent,,

I also watch just now, the two are static library compile multi-threaded debugging MTD or error,,,

CodePudding user response:

The error LNK2005: "void __cdecl _invalid_parameter (unsigned short const *, unsigned short const *, unsigned short const *, unsigned int, unsigned int)" (? _invalid_parameter @ @ YAXPBG00II @ Z) have been libcmtd. Lib (invarg. Obj) defined in the
Error LNK2005: ___pInvalidArgHandler already in libcmtd. Lib (invarg. Obj) defined in the
Error LNK2005: __call_reportfault already in libcmtd. Lib (invarg. Obj) defined in the
Error LNK2005: __get_invalid_parameter_handler already in libcmtd. Lib (invarg. Obj) defined in the
Error LNK2005: __invalid_parameter already in libcmtd. Lib (invarg. Obj) defined in the


What is the meaning of such a mistake?

CodePudding user response:

reference 1st floor MonkeyKingMKY response:
exe DLL in the same folder
Lib to try to introduce in the compiler
Point file to expand into the function called statement or directly include your export function. H file



I now have a iLBC lib reference in an error, error content on the 6th floor!

But I always can't find the cause of the error!!!!! Check some information, also do not know how to solve this mistake!!

CodePudding user response:

Equivalent to repeat definition
Just happened in the link

CodePudding user response:

By bumps bumps bumps bumps bumps bumps bumps bumps bumps bumps bumps bumps bumps bumps

CodePudding user response:

The
reference 11 floor MonkeyKingMKY response:
definition is equivalent to repeat
Just happened at link time


reference 1st floor MonkeyKingMKY response:
exe DLL in the same folder
Lib to try to introduce in the compiler
Point file to expand into the function called statement or directly include your export function. H file



I quote the lib in the project properties (specifies the lib folder) also cited a code file, the error,

If I don't write this in your code # pragma co. Ilbc. Lib, he would have to find error function!

CodePudding user response:

Don't know what do you use the compiler,
C + + Builder of can directly Add
V, have to set up in what engineering properties,

C + + Builder also can
# pragma link * * *. "lib"
The

CodePudding user response:

The lib. If it is a different version of the BCB or other compilers compiled lib, had better use the current version CB recompiling.
Microsoft's LIB cannot directly in CB,nullnullnullnullnull
  • Related