Menu

#6 Wrong parameter type in DLL

v1.0 (example)
closed
oparviai
None
5
2017-03-05
2017-03-01
7heW4yne
No

Hello.

In the SoundTouchDLL.cpp the methods "soundtouch_putSamples" and "soundtouch_receiveSamples" are implemented with parameter type "SAMPLETYPE", which is in fact "short" or "float".

BUT in the header file "SoundTouchDLL.h" these parameters are declared as "float".
If the SAMPLETYPE of the lib is set to "short", this causes the following errors:

Error   2   error C2733: 'soundtouch_putSamples' : second C linkage of overloaded function not allowed
Error   3   error C2733: 'soundtouch_receiveSamples' : second C linkage of overloaded function not allowed

I think there are 2 options to fix it:

  1. Change the parameter type in the dll header to "soundtouch::SAMPLETYPE".
  2. Provide methods for both types in the dll code and convert the types (which is a little bit slower, but produduces a reusable dll no matter what SAMPLETYPE the lib use).

Greets from Germany

Discussion

  • oparviai

    oparviai - 2017-03-05

    Thanks for the comments. To avoid mess with incompatible DLL variations, I addressed this by adding new convenience functions to the SoundTouch.dll API that allow using int16/short sample format. These function perform int16<->float data conversion inside the dll:
    soundtouch_putSamples_i16()
    soundtouch_receiveSamples_i16()

     
  • oparviai

    oparviai - 2017-03-05
    • status: open --> closed
    • assigned_to: oparviai
     

Log in to post a comment.

MongoDB Logo MongoDB