Aha. After writing 90% of this response, a light bulb went on and I figured it out. I will post this anyway in case this helps someone else. Bottom line - I had neglected to put the gluecode.c in my project so the function definitions were not found, only the prototypes. If you want to see what I was writing before enlightenment, read on.
My project may sound a bit convoluted. My main program needs to access functions in several DLL's, and some of these DLL's need to access functions in my main program as well. At runtime, my main.c gets the type of the currently installed hardware, and calls the appropriate DLL's. Loading dynamically this way precludes putting the .lib in the main project. I created some glue code in a ki
nd of 'middle-man' way - call it gluecode.c. It has all the prototypes of the dll in its .h, and has the GetProcessAddr() function to assign pointers to the dll functions. Below this there are simple functions. It looks like this:
int LoadMotionDll(char *szDllName)
{
MotionDLLHandle = LoadLibrary(szDllName);
if (MotionDLLHandle == NULL)
{
return kFailedToLoadDllError;
}
if (!(ConfigMotionPortPtr = (void*)GetProcAddress(MotionDLLHandle, "ConfigMotionPort")) )
goto FunctionNotFoundError;
return 0;
}
// Glue code for each DLL function
int __stdcall ConfigMotionPort (int com_port, int baud, int parity, int data,
int stop, double user_units, double accel,
double velocity)
{
return (*ConfigMotionPortPtr)(com_port, baud, parity, data, stop, user_units, accel, velocity);
}
This works great when accessing the functions from my main.c code. This gluecode.c is in my main project along with its .h. But no .lib need
be in the project.