mpz_import/mpz_export and syntax errors

Evan Dower evantd@u.washington.edu
02 May 2003 16:03:32 -0700


I am having a really strange problem with mpz_import and mpz_export. GCC
is giving me "syntax error before ';' token" errors. Maybe I'm just
doing something stupid and it just happens to be only at the 6 places
where I call mpz_import and mpz_export, but I'm guessing it has
something to with the mpz_??port functions in particular. These are the
only errors in my code. I really just can't figure out what I'm doing
wrong. Any help would be greatly appreciated. Pertinent information
follows.
Thanks in advance,
Evan Dower
First time GMP user

I am compiling with:
gcc -I/usr/local/include -L/usr/local/lib -lgmp -Wall -ansi -o test
test.c

on:
$uname -a
FreeBSD lojak.washington.edu 5.0-RELEASE-p7 FreeBSD 5.0-RELEASE-p7 #0:
Tue Apr 1 18:34:29 PST 2003    
evantd@lojak.washington.edu:/usr/obj/usr/src/sys/CUSTOM  i386

My code is:
...
#define word_bytes 4
...
void
mpz_dbtify( DBT *dbt, mpz_t mpz )
{
  size_t words;
  
  free(dbt->data);
  dbt->data = NULL;
  
  mpz_export(dbt->data, &words, 1, word_bytes, 0, 0, mpz);
  (*dbt).size = words * word_bytes;
}

void
mpz_undbtify( mpz_t mpz, const DBT* dbt )
{
  mpz_import(mpz, dbt->size/word_bytes, 1,word_bytes,0,0, dbt->data);
}
...