Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: undefined reference to _GC_malloc



Why do both projects need gc.lib? After all, the static library will not be
linked, only ar'ed, when the project is compiled.

Anyway, I am having trouble reproducing the problem.  It is one I have often
and in different projects, yet sometimes I can compile fine, other times
not, yet I cannot see what the change is in the code / project options.

Perhaps it is a bug in lcc, as I am using the lcc extensions:
eg generic functions, and the lpVtbl shortcut.

Cheers anyway.
- Luke


"Friedrich Dominicus" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I tried to set up projects such that this error shows. However I'm not
able
> to repeat it. All works as expected here. Here's my example static library
> source:
> #include <gc.h>
> #include <string.h>
>
>
> char * MyStrDup(char* str){
>  char *result = GC_MALLOC(strlen(str) + 1);
>  strcpy(result, str);
>  return result;
> }
>
> linked against gc.lib
>
> and this is the project which used that library:
> #include <gc.h>
> #include <stdio.h>
>
> extern char* MyStrDup(char*);
>
> int main (void){
>  char *tstr = MyStrDup("I'm a string");
>  printf("tstr = %s\n", tstr);
>  GC_FREE(tstr);
>  return 0;
> }
> linked against strdup.lib and gc.lib
> Both projects do need gc.lib. Is that the same as you setup?
>
> Regards
> Friedrich
>
>





<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.