Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5339

CVI 2013 generate invalid code

$
0
0

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);
}

 


Viewing all articles
Browse latest Browse all 5339

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>