Pokusaj da izvuces nesto iz ovoga (nisam ukljucivao VC IDE)
Code:
UINT res;
HINSTANCE hInst;
LPFNDLLFUNC1 fnFunc1;
hInst = LoadLibrary("zLib.dll");
if ( hInst )
{
fnFunc1 = (LPFNDLLFUNC1)GetProcAddress( hInst, "compress");
if ( fnFunc1 )
{
// url: http://www.bzflag.org/doxygen/zlib_8h-source.html
//ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
00609 const Bytef *source, uLong sourceLen));
00610 /*
00611 Compresses the source buffer into the destination buffer. sourceLen is
00612 the byte length of the source buffer. Upon entry, destLen is the total
00613 size of the destination buffer, which must be at least 0.1% larger than
00614 sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
00615 compressed buffer.
00616 This function can be used to compress a whole file at once if the
00617 input file is mmap'ed.
00618 compress returns Z_OK if success, Z_MEM_ERROR if there was not
00619 enough memory, Z_BUF_ERROR if there was not enough room in the output
00620 buffer.
00621 */
unsigned char *dst = ... tvoj bafer gde ces da smestas kompresovane podatke
UINT dstLen = 1200;
const unsigned char *src = ... ovih 1000 bajtova kompresujes
res = fnFunc1( dst, &dstLen, src, 1000 );
if ( res != Z_OK ) //
{
// greska
}
}
...
// ovo pozovi kad ti vise ne bude trebala ni jedna zip f-ja
FreeLibrary(hInst);
}
Let the force be with U jer postaces dzedaj ako ovako budes resavao.
Za svaku funkciju koju ces da koristis po jednom pozovi GetProcAddress.
A da nadjes zlib.lib i staticki linkujes ili ipak da nadjes neki wrapper i sebi ulepsas zivot?
Puno srece