[gnutls-help] Using gnutls_malloc()
nmav at gnutls.org
Tue Mar 24 09:17:23 CET 2015
On Mon, Mar 23, 2015 at 5:52 PM, Vladimir Levijev
<vladimir.levijev at gmail.com> wrote:
> I can't figure out why gnutls_malloc() is never resolved on Windows
> (2008, 32-bit) here. I'm using this code sample:
> #include <gnutls/gnutls.h>
> int main()
> void *p = gnutls_malloc(10);
> return 0;
> It compiles perfectly on GNU/Linux (gcc /tmp/hellognutls.c -o
> /tmp/hellognutls -Wall -lgnutls, I'm using version 2.12.20 though) but
> on Windows (I'm using latest pre-compiled library from gnu.org,
> 3.3.13) I get linking error:
>>cl hellognutls.c -I \gnutls\include /c /Fo"hellognutls.o"
> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
> Copyright (C) Microsoft Corporation. All rights reserved.
I have no such issue when using mingw to compile with the library.
> which means gnutls.h is included properly. It only helps if I manually define
> gnutls_alloc_function gnutls_malloc = malloc;
That's pretty strange. A work around could be to simply use malloc()
as in the latest versions there is no way to override the gnutls
memory functions. That may not be very future proof though.
More information about the Gnutls-help