Plexon C++ API on 64-bit Linux

Plexon has a C++ SDK which I was toying around with because all Plexon software including the Matlab API is Windows only, and all of our analyses run on 64-bit Ubuntu. So I figured the command line version of the .plx reader could be modified to run on Linux and suit our needs. Surprisingly, this is pretty easy:

  1. In Plexon.h, remove all references to the Windows API.
  2. This is the hard part to figure out: in Plexon.h, in the definition of struct PL_DataBlockHeader, change unsigned long TimeStamp to unsigned int TimeStamp. A long is 8 bytes in 64-bit Linux g++ but 4 bytes in MSVC, so as is the file reader will read too many bytes per data block and then the data won’t be aligned anymore and it will crash.
  3. In plxread.cpp, #define LONGLONG long or #define LONGLONG int64_t
  4. Compile with g++
  5. If g++ bothers you about *printf, change %I64 tokens to %ld.

It should work as is. This also works for Mac. See here for an example of how you can use the SDK to process .plx files on non-Windows OS. Alternative approaches to reading .plx files in Linux include using Python with OpenElectrophy and the FieldTrip toolbox in Matlab.


4 thoughts on “Plexon C++ API on 64-bit Linux

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s