Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Calling wavpackdll.dll from VB (Read 5809 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Calling wavpackdll.dll from VB

I have created a simple audio program with Visual basic 6 and would like to include Wavpack support, specifically the decoding functions. I keep getting a “Bad dll calling convention” error when I try to call the WavpackOpenFileInput function.

VB Declare statement
Code: [Select]
Private Declare Function WavpackOpenFileInput Lib "wavpackdll.dll" ( _
                     ByVal infilename As String, _
                     ByVal error As String, _
                     ByVal Flags As Long, _
                     ByVal norm_offset As Long) As Long

Calling fuinction
Code: [Select]
Public Function WaveUnpack(WavPackFileSpec As String) As Boolean

Dim WavpackContext   As Long
Dim ErrorString      As String
Dim Flags1           As Long
Dim norm_offset      As Long

Flags1 = 0
norm_offset = 0
ErrorString = Space(80)

WavpackContext = WavpackOpenFileInput(WavPackFileSpec, ErrorString, Flags1, norm_offset)

End Function

Any help please

Microsoft Visual Basisc 6.0 (SP6)
Microsoft XP SP2

Calling wavpackdll.dll from VB

Reply #1
I have no idea how exactly to call from VB, but it seems like the string parameters would be by reference rather than by value, unless VB always passes strings by value.

Another thing is that perhaps the name has some decoration, like _WavpackOpenFileInput. Again, I have no VB experience.

Hopefully someone who does can take a look here and see an obvious problem... 

David


Calling wavpackdll.dll from VB

Reply #2
I assume it's because VB can call only functions using stdcall calling convention. The WavPack library apparently uses C-calling convention (cdecl).
See google.com/search?q=call+cdecl+dll+function+visual+basic for workarounds.
Full-quoting makes you scroll past the same junk over and over.