45.QT- connect an external DLL, call the resolve to address the cause of failure

See MZ_Card.dll document corresponding to the manual, as shown below:

So the code is written as:

BOOL typedef (Fun *) (BOOL IsOpenComm, unsigned Long Port, unsigned Long nBaud, unsigned int BeepCnt); // definition of function pointers 
void FUNC () 
{ 
    
       Fun Open = (Fun) mylib.resolve ( " MZ_Card.dll " , " SendBeep " );     // invoke the function 
       iF (Open)                   // if successfully connected the function 
       { 
                 qDebug () << " Link to function IS the OK! " ; 
                 qDebug () << Open ( to true , 19, 38400 , 2 );       // this function pointer to a function call to the dll SendBeep 
       }
        the else 
                 qDebug () << " Linke to the OK Not Function IS !!!! " ; 
}

Print run, found call resolve failed:

Is it the function name wrong?

 

Open MZ_Card.dll, keyword search SendBeep with Notepad, found as shown below:

Clearly document and does not give the same, there may be differences compiler so it modify the code:

Fun open=(Fun)mylib.resolve("MZ_Card.dll","_SendBeep@16");

After running OK:

 

 

 

Guess you like

Origin www.cnblogs.com/lifexy/p/10954438.html