Using the FTDI API compiles and links fine under Visual Studio 2012.
but under VS 2014, it gives:
Error LNK2019: unresolved external symbol ___iob_func referenced in function "void __cdecl Padding(int)"
Have the standard libraries changed?
Yes, the standard libraries have changed, and FTDI doesn't seem to care - at least not as of CDM2.12.18 driver version.
The problem is described in the answers to this question.
The void __cdecl Padding(int)
function from devcon.obj
within ftd2xx.lib
is the culprit. It references one of stdin
, stdout
or stderr
, given as macros. The contents of these macros changed.
Since we don't really expect any I/O from the FTDI library, we might as well provide the simplest implementation possible:
FILE* __cdecl _imp____iob_func() { return 0; }
If you want a version that does what it's supposed to do:
FILE* __cdecl _imp____iob_func()
{
struct _iobuf_VS2012 { // ...\Microsoft Visual Studio 11.0\VC\include\stdio.h #56
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname; };
// VS2015 has FILE = struct {void* _Placeholder}
static struct _iobuf_VS2012 bufs[3];
static char initialized = 0;
if (!initialized) {
bufs[0]._ptr = stdin->_Placeholder;
bufs[1]._ptr = stdout->_Placeholder;
bufs[2]._ptr = stderr->_Placeholder;
initialized = 1;
}
return (FILE*)&bufs;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With