Im creating a library to interface into drawing a specific file type. This library needs to pull in a 3rd party library to do some processing on this specific file type. This 3rd party lib requires the users of it to create some extern functions that it uses to make data types on target hardware.
So, it looks like this:
----------------
| |
| 3rd Party |
| Lib |
| |
----------------
|
|
\/
---------------
| |
| My Lib |
---------------
| externs |
---------------
|
|
\/
---------------
| |
| My App |
| |
| |
---------------
My App calls My Lib and says "draw me file X", My Lib does a bunch of junk eventually calling 3rd Party Lib and says "process file X". 3rd Party Lib requires several externs to be declared that it uses.
I made all these externs inside My Lib. My problem is, when I link My App, its telling me undefined references to all the extern functions. I can't figure out why. Heres one of the externs inside My Lib to be called by 3rd Party Lib:
// inside typeConversions.c
extern int CreateShort(short* shortList, int numShorts)
{
int i;
for(i = 0; i < numShorts; i++)
{
BYTE_SWAP_SHORT(shortList[i]);
}
return ERROR_OK;
}
When I link My App I get (among several other similar errors):
open.cpp: undefined reference to `CreateShort'
Where open.cpp is inside the 3rd Party Lib.
I have both My Lib and 3rd Party Lib included in My App. Ideally, I want to not expose users of My Lib to 3rd Party Lib, so for example My App would not have to include 3rd Party Lib at all, they dont know it even exists. All that should be exposed is My Lib. Is this possible? Anyone know how to fix my linking problem?