Hi,
CVI 2013 generate invalid code for function pointer.
For example, this code works fine in CVI 2012, but not in CVI 2013. Any idea?
#include <windows.h>
#include <stdio.h>
struct FunctionType
{
const char *name;
void *func;
};
static const struct FunctionType functions[] =
{
{ "func", GetFullPathName },
};
typedef DWORD (WINAPI *GetPathFunc)(LPCSTR, DWORD, LPSTR, LPSTR *);
int main(int argc, char *argv[])
{
char buf[256];
GetPathFunc f = (GetPathFunc)functions[0].func;
if (f != GetFullPathName) {
puts("Invalid ptr");
} else {
if (f(argv[0], sizeof(buf), buf, NULL) > 0) {
puts(buf);
}
}
return (0);
}