Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

64-bit safe library for Windows?

x86_64 labjackud.lib

  • Please log in to reply
1 reply to this topic

#1 Phil H

Phil H
  • Members
  • 1 posts

Posted 19 June 2015 - 03:56 PM

I'm the very satisfied owner of three U6 Pros.  They work great, they're easy to control, and I've never had a hardware problem with any of them.  (Real DACs and faster SPI would be a plus, but hey, the boxes are very inexpensive.)

 

There's a really ugly wart in the development tools, though, namely having to use reinterpret_cast<long> to pass a pointer-to-double.  Typical 64-bit compilers have 32-bit longs and 48-bit pointers, so this approach seems to be "for a good time, not a long time."

 

Is there any motion towards cleaning up the library interface for 64-bit code?

 

(One of the benefits of using "reinterpret_cast<long>(foo)" instead of the C-style "(long) foo" is that it's easy to search for, and its wartiness is immediately apparent.)

 

Thanks

 

Phil Hobbs



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 19 June 2015 - 04:57 PM

Hi Phil,

 

The original design of the x1 parameters for certain functions in the UD driver only accounted for passing 32-bit pointer addresses as you mentioned, but we did later add "Ptr" versions of functions to pass pointers in a 64-bit safe way. The long x1 parameters in those functions were changed to void *, and are recommended for 64-bit applications. Here's AddRequestPtr function prototype in LabJackUD.h:

LJ_ERROR _stdcall AddRequestPtr(LJ_HANDLE Handle, long IOType, long Channel, double Value, void *x1, double UserData);

Refer to the LabJackUD.h header file as these "Ptr" functions are not documented in the User's Guides currently and in the most recent release we added a comment towards the top of the header file to make their usage more apparent:

 

"The Ptr form of these functions (the ones with Ptr at the end) take a void * instead of a long for the x1 parameter. This allows the x1 parameter to be 64-bit pointer address safe, and is required in 64-bit applications when passing an pointer/array to x1."




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users