ps2000aOpenUnit not found in libps2000a.dylib by QLibrary

Post your C and C++ discussions here
Post Reply
greanie
Newbie
Posts: 0
Joined: Tue Jun 01, 2010 10:12 am

ps2000aOpenUnit not found in libps2000a.dylib by QLibrary

Post by greanie » Wed Jan 09, 2019 4:29 pm

I am integrating PicoScope support into a QT application. Using QLibrary, I am able to load the library but when I attempt to get a pointer to the ps2000aOpenUnit function, the function is not found.

Code: Select all

//open unit and show splash screen
    ps2000aLib = new QLibrary( QString(PICOSCOPE_LIBRARY_DIR_PATH) + QString(PICOSCOPE2000A_LIBRARY) );
    if( ! ps2000aLib->isLoaded() ) {
        qDebug() << "ps2000a dll did not load";
        return;
    }

    typedef PICO_STATUS (*PS2000aOpenUnit)( int16_t*, int8_t*);
    PS2000aOpenUnit ps2000aOpenUnit = (PS2000aOpenUnit) ps2000aLib->resolve("ps2000aOpenUnit");
    if( ! ps2000aOpenUnit ) {
        qDebug() << "ps2000aOpenUnit function not found in library";
        return;
    }

    PICO_STATUS psStatus = ps2000aOpenUnit( &unitOpened_m.handle, unitOpened_m.serial );
When I call nm -gUj .../libps2000a.dylib, of course the symbol is listed.

QLibrary requires that the library be compiled in C. All the provided sample code is in C, so I assume so. Can someone confirm that the dynamic libraries are compiled with a C compiler and not a C++ compiler? Or am I doing something else wrong?

Martyn
Site Admin
Site Admin
Posts: 3464
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: ps2000aOpenUnit not found in libps2000a.dylib by QLibrary

Post by Martyn » Mon Jan 14, 2019 8:14 am

From the Programmer's Guide

Code: Select all

The ps2000a API exports a number of functions for you to use in your own applications. All functions are C
functions using the standard call naming convention (__stdcall). They are all exported with both decorated
and undecorated names
Martyn
Technical Support Manager

greanie
Newbie
Posts: 0
Joined: Tue Jun 01, 2010 10:12 am

Re: ps2000aOpenUnit not found in libps2000a.dylib by QLibrary

Post by greanie » Mon Jan 14, 2019 11:30 am

Hi Martyn, Thanks for the additional information. The issue was more related to QT. I was missing the library path in my DYLD_LIBRARY_PATH environment variable. Once that included, it worked. I got this information from the QT user forum.

Post Reply