Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows bug fix #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@ endif (NOT WIN32)
# ==================================================

set(vxi11_SRCS library/vxi11_user.c library/vxi11_user.h)

if (WIN32)
include_directories(C:\\VXIpnp\\WINNT\\include)
link_directories(C:\\VXIpnp\\WINNT\\lib\\msc)
# Default path for IVI Visa under Windows should be
# C:\Program Files (x86)\IVI Foundation\VISA
set(ivi_path "C:\\Program Files (x86)\\IVI Foundation\\VISA")
include_directories("${ivi_path}\\WinNT\\include")
link_directories("${ivi_path}\\WinNT\\lib\\msc")

# Path for library headers needed by utils
include_directories("${vxi11_SOURCE_DIR}\\library")
else (WIN32)
set(vxi11_SRCS ${vxi11_SRCS} library/vxi11.h library/vxi11_clnt.c
library/vxi11_xdr.c library/vxi11.x)
set(vxi11_SRCS ${vxi11_SRCS}
library/vxi11.h
library/vxi11_clnt.c
library/vxi11_xdr.c
library/vxi11.x)
endif (WIN32)


Expand Down
14 changes: 8 additions & 6 deletions library/vxi11_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,17 @@ int vxi11_open_device(VXI11_CLINK **clink, const char *address, char *device)
}

#ifdef WIN32
status = viOpenDefaultRM(&clink->rm);
status = viOpenDefaultRM(&(*clink)->rm);
if (status != VI_SUCCESS) {
viStatusDesc(NULL, status, buf);
viStatusDesc(0, status, buf);
printf("%s\n", buf);
free(*clink);
*clink = NULL;
return 1;
}
viOpen(clink->rm, (char *)address, VI_NULL, VI_NULL, &clink->session);
viOpen((*clink)->rm, (char *)address, VI_NULL, VI_NULL, &(*clink)->session);
if (status != VI_SUCCESS) {
viStatusDesc(clink->rm, status, buf);
viStatusDesc((*clink)->rm, status, buf);
printf("%s\n", buf);
free(*clink);
*clink = NULL;
Expand Down Expand Up @@ -294,9 +294,10 @@ int vxi11_send(VXI11_CLINK * clink, const char *cmd, size_t len)
char *send_cmd;
#endif
size_t bytes_left = len;
ssize_t write_count;

#ifdef WIN32
ViUInt32 write_count = 0;

send_cmd = (unsigned char *)malloc(len);
if (!send_cmd) {
return 1;
Expand Down Expand Up @@ -390,10 +391,11 @@ ssize_t vxi11_receive(VXI11_CLINK * clink, char *buffer, size_t len)
ssize_t vxi11_receive_timeout(VXI11_CLINK * clink, char *buffer, size_t len,
unsigned long timeout)
{
size_t curr_pos = 0;
#ifdef WIN32
ViUInt32 curr_pos = 0;
viRead(clink->session, (unsigned char *)buffer, len, &curr_pos);
#else
size_t curr_pos = 0;
Device_ReadParms read_parms;
Device_ReadResp read_resp;

Expand Down
5 changes: 0 additions & 5 deletions utils/vxi11_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,8 @@
#include "vxi11_user.h"
#define BUF_LEN 100000

#ifdef WIN32
#define strncasecmp(a, b, c) stricmp(a, b)
#endif

int main(int argc, char *argv[])
{

char *device_ip;
char *device_name = NULL;
char cmd[256];
Expand Down
4 changes: 0 additions & 4 deletions utils/vxi11_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@

#include "vxi11_user.h"

#ifdef WIN32
#define strncasecmp(a, b, c) stricmp(a, b)
#endif

int main(int argc, char *argv[])
{

Expand Down