NO

Author Topic: including an objects library while linking a project  (Read 4807 times)

gilliandell

  • Guest
including an objects library while linking a project
« on: May 27, 2008, 02:20:55 AM »
Hi,

I build a LIBrary project contnaing several C objects, which I intened to used in serveral projects.
I build the library file.

Now a differnet project I put the path of the library in the project folders, but while linking I get:
POLINK: error: Unresolved external symbol '_Trim'.
POLINK: error: Unresolved external symbol '_CompressByItem'.

Next I copied the library to the project home and put it in the project linker tab under 'library and object files', linked it and
still get the same messages.

Where did I go worng?

Gillian

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: including an objects library while linking a project
« Reply #1 on: May 27, 2008, 08:31:58 AM »
If you have set "Undecorate exported __stdcall functions" in you library project, you need to omit the leading underscore.
---
Stefan

Proud member of the UltraDefrag Development Team

gilliandell

  • Guest
Re: including an objects library while linking a project
« Reply #2 on: May 27, 2008, 04:54:51 PM »
If haven't set "Undecorate exported __stdcall functions" in my library project.

it's defined as a Single-theared (LIB) and Calling cov __cdecl.
In the options, only 'Enable Microsoft extensions' is checked.

Gillian

gilliandell

  • Guest
Re: including an objects library while linking a project
« Reply #3 on: May 27, 2008, 05:03:26 PM »
The code is very simple:

# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include  "OCIMod.h"

extern char * Trim();
extern char * CompressByItem();

char *ModuleDir = "OCIModdir", *FileSuffix = ".ocimod";

int  main (int argc, char **argv)
{
  int i;
  FILE *fp;
  char *FileName, FinFileName[FileSize + 1],
      Buf[MaxSize + 1];

  if (argc < 2)
     {
       puts ("You have to enter OCI Module Procedure");
       exit(False);
  }
  FileName = malloc((strlen(argv[1]) + 1) * sizeof(char));
  strcpy(FileName,argv[1]);
  sprintf(FinFileName,"%s\\%s%s%c",ModuleDir,FileName,FileSuffix,0);
  if  ((fp=fopen(FinFileName,"r")) == NULL)
      {
    puts("File Not Found");
    exit(False);
  }
  i = 0;
  while (!feof(fp))
     {
       fgets(Buf,MaxSize,fp);
       if (feof(fp)) continue;
   Trim(Buf,NULL);
   CompressByItem(Buf," ",NULL);

   printf("%03d - %s",i++,Buf);
   }
   fclose(fp);
   return(True);
}

Trim() and CompressByItem are 2 Pelles C objects residing in the Library project.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: including an objects library while linking a project
« Reply #4 on: May 27, 2008, 07:41:59 PM »
just guessing:
change this
Code: [Select]
extern char * Trim();
extern char * CompressByItem();
fill function parameters something like this:
Code: [Select]
extern char * Trim(char *, char *);
extern char * CompressByItem(char *, char *, char *);
copy those from that library code.


May the source be with you