Re: [Dev-C++] Is a struct preserved when used into a cpp file?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2004-01-27 15:38:02
|
If the MD5Init function is implemented in C, you should modify the header
file to specify
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
To make sure that a c++ program knows that the MD5Init() function should
be called with the C calling convention, and that the name isn't mangled
in the library, i.e. that the code should link with a symbol called
_MD5Init
/Per W
On Tue, 27 Jan 2004, Vinicius wrote:
> Hello,
>
> a) I have a .h (header file) that declares a struct:
> ...
> typedef struct {
> UINT4 state[4]; /* state (ABCD) */
> UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
> unsigned char buffer[64]; /* input buffer */
> } MD5_CTX;
> ...
>
> b) and I have .c (C source file) that uses the header above:
> ...
> void MD5Init(MD5_CTX *context);
> ...
>
> c) I have created a .lib (library file) with the functions above.
>
> I have used the header file above into a .cpp (C++ source file). The .cpp
> file uses the .lib functions, but the compiles says "Unresolved external
> MD5Init(MD5_CTX*) ...".
>
> I think the .lib was included correctly on the project, so is a struct
> preserved when used into a cpp file?
>
> Thanks in advance, Vinicius.
>
> PS: I'm using actually the Borland C++Builder 3 IDE for this project, but my
> doubts is concerned about the theory, excuse me for anything.
>
|