Bad DLL calling covention '49' 
Author Message
 Bad DLL calling covention '49'

Hi grp
I'm using a dll for synthetic speech from someone else.
They recomend calling MBR_MBRUnload before closing the app.
But calling the Unload of the dll causes err 49. Is there some calling
convention I haven't activated or is the dll missbehaving? Other calls to
the dll for speech works ok.
Is there some other bulldozer way to unload the dll to not have a
memory-leak.
This is the supplied declare

/Henning



Sat, 25 Jun 2005 04:55:51 GMT  
 Bad DLL calling covention '49'
On Mon, 6 Jan 2003 21:55:51 +0100, "Hero Home.se"

Quote:

>Hi grp
>I'm using a dll for synthetic speech from someone else.
>They recomend calling MBR_MBRUnload before closing the app.
>But calling the Unload of the dll causes err 49. Is there some calling
>convention I haven't activated or is the dll missbehaving? Other calls to
>the dll for speech works ok.
>Is there some other bulldozer way to unload the dll to not have a
>memory-leak.
>This is the supplied declare


You have that declared as a function, yet i see no return type ? If it
returns a value add an "As Long", if it doesn't return make it a Sub.

Other than that...
Maybe they've supplied the wrong alias ? Do a dump of the exported
functions and see.
If it's properly written, it should clean up on exit, which windows
will envoke once a DLL's ref count drops to 0.
On the other hand you can't be sure and since the above may indicate
that they've forgot to _stdcall that last function, i'd get in contact
with them and ask the question.

--
Happy 2003 !

Regards, Frank



Sat, 25 Jun 2005 06:00:16 GMT  
 Bad DLL calling covention '49'

Quote:

> Hi grp
> I'm using a dll for synthetic speech from someone else.
> They recomend calling MBR_MBRUnload before closing the app.
> But calling the Unload of the dll causes err 49. Is there some calling
> convention I haven't activated or is the dll missbehaving? Other
> calls to the dll for speech works ok.
> Is there some other bulldozer way to unload the dll to not have a
> memory-leak.
> This is the supplied declare
> Declare Function MBR_MBRUnload Lib "mbrplay.dll" Alias

> /Henning

Functions declared with no return type are expected to return a Variant.
If the function is really a void function (in C terms), this results in
a stack misalignment, detected as an improper calling convention.

Declare it as a Sub instead.

--

    Jim Mack
    MicroDexterity Inc
    www.microdexterity.com



Sat, 25 Jun 2005 08:37:59 GMT  
 Bad DLL calling covention '49'
U got a point!
I found a C declaration and that is from the owner of the dll
void long _MBR_MBRUnload....
Why this??
I will try do change the declaration to Sub, and see if I have to reboot :-)



Quote:

> > Hi grp
> > I'm using a dll for synthetic speech from someone else.
> > They recomend calling MBR_MBRUnload before closing the app.
> > But calling the Unload of the dll causes err 49. Is there some calling
> > convention I haven't activated or is the dll missbehaving? Other
> > calls to the dll for speech works ok.
> > Is there some other bulldozer way to unload the dll to not have a
> > memory-leak.
> > This is the supplied declare
> > Declare Function MBR_MBRUnload Lib "mbrplay.dll" Alias

> > /Henning

> Functions declared with no return type are expected to return a Variant.
> If the function is really a void function (in C terms), this results in
> a stack misalignment, detected as an improper calling convention.

> Declare it as a Sub instead.

> --

>     Jim Mack
>     MicroDexterity Inc
>     www.microdexterity.com



Sat, 25 Jun 2005 08:47:13 GMT  
 Bad DLL calling covention '49'
WRONG of me it is:
void WINAPI MBR_MBRUnload()



Quote:
> U got a point!
> I found a C declaration and that is from the owner of the dll
> void long _MBR_MBRUnload....
> Why this??
> I will try do change the declaration to Sub, and see if I have to reboot
:-)




> > > Hi grp
> > > I'm using a dll for synthetic speech from someone else.
> > > They recomend calling MBR_MBRUnload before closing the app.
> > > But calling the Unload of the dll causes err 49. Is there some calling
> > > convention I haven't activated or is the dll missbehaving? Other
> > > calls to the dll for speech works ok.
> > > Is there some other bulldozer way to unload the dll to not have a
> > > memory-leak.
> > > This is the supplied declare
> > > Declare Function MBR_MBRUnload Lib "mbrplay.dll" Alias

> > > /Henning

> > Functions declared with no return type are expected to return a Variant.
> > If the function is really a void function (in C terms), this results in
> > a stack misalignment, detected as an improper calling convention.

> > Declare it as a Sub instead.

> > --

> >     Jim Mack
> >     MicroDexterity Inc
> >     www.microdexterity.com



Sat, 25 Jun 2005 08:49:13 GMT  
 Bad DLL calling covention '49'
Did a little change added As Long
 Declare Function MBR_MBRUnload Lib "mbrplay.dll" Alias

In Form_Unload I do dim tmp, tmp = MBR_MBRUnload()
Now I don't get the error msg, but closing the app also closes the ide
??
Must be some bad function in the dll, or?
I have contacted the author, but as almost always answeres are slow. And as
usual (at least for me) the app should have been ready a couple of weeks ago
:-((



Quote:

> > Hi grp
> > I'm using a dll for synthetic speech from someone else.
> > They recomend calling MBR_MBRUnload before closing the app.
> > But calling the Unload of the dll causes err 49. Is there some calling
> > convention I haven't activated or is the dll missbehaving? Other
> > calls to the dll for speech works ok.
> > Is there some other bulldozer way to unload the dll to not have a
> > memory-leak.
> > This is the supplied declare
> > Declare Function MBR_MBRUnload Lib "mbrplay.dll" Alias

> > /Henning

> Functions declared with no return type are expected to return a Variant.
> If the function is really a void function (in C terms), this results in
> a stack misalignment, detected as an improper calling convention.

> Declare it as a Sub instead.

> --

>     Jim Mack
>     MicroDexterity Inc
>     www.microdexterity.com



Sat, 25 Jun 2005 09:53:47 GMT  
 Bad DLL calling covention '49'
On Tue, 7 Jan 2003 02:53:47 +0100, "Hero Home.se"

Quote:

>Did a little change added As Long
> Declare Function MBR_MBRUnload Lib "mbrplay.dll" Alias

>In Form_Unload I do dim tmp, tmp = MBR_MBRUnload()
>Now I don't get the error msg, but closing the app also closes the ide
>??

It closes the IDE because it crashes VB.
Btw, you should always Dim to the type that is expected by APIs, they
are very touchy about these things. That should be Dim tmp As Long.
Although in the previous post you said that the C declaration is :
void MBR_MBR_Unload(), so this fnction does not return, hence it
should be declared as a Sub in VB.
Have you tried with the Sub ?

Quote:
>Must be some bad function in the dll, or?
>I have contacted the author, but as almost always answeres are slow. And as
>usual (at least for me) the app should have been ready a couple of weeks ago
>:-((

Dam {*filter*}y programmers, they're all alike.. ;-)

--
Happy 2003 !

Regards, Frank



Sat, 25 Jun 2005 10:05:58 GMT  
 Bad DLL calling covention '49'



Quote:
> On Tue, 7 Jan 2003 02:53:47 +0100, "Hero Home.se"

> >Did a little change added As Long
> > Declare Function MBR_MBRUnload Lib "mbrplay.dll" Alias

> >In Form_Unload I do dim tmp, tmp = MBR_MBRUnload()
> >Now I don't get the error msg, but closing the app also closes the ide
> >??
> It closes the IDE because it crashes VB.
> Btw, you should always Dim to the type that is expected by APIs, they
> are very touchy about these things. That should be Dim tmp As Long.
> Although in the previous post you said that the C declaration is :
> void MBR_MBR_Unload(), so this fnction does not return, hence it
> should be declared as a Sub in VB.
> Have you tried with the Sub ?

> >Must be some bad function in the dll, or?
> >I have contacted the author, but as almost always answeres are slow. And
as
> >usual (at least for me) the app should have been ready a couple of weeks
ago
> >:-((

> Dam {*filter*}y programmers, they're all alike.. ;-)

> --
> Happy 2003 !

> Regards, Frank

Some kind of weird more or less human look-alikes 8>()
Tryed declare as a sub, no difference, ide still closes. Have to use it as
this till I get an answere from the source. Lyckily my user doesn't run it
in the ide...
Thanx 4 trying, I'll report when it is solved if ever....
Sincerely /Henning


Sat, 25 Jun 2005 10:21:33 GMT  
 Bad DLL calling covention '49'
Hero Home,

Try to make your .exe file, and run it outside of VB IDE and see what
happen.

In my case, application runs in .exe but crashes after getting stupid
error "49".

Anybody has fixed this problem (i.e. error 49 in IDE), PLEASSE pose
your solutions. Thanks a lot.

Quote:



> > On Tue, 7 Jan 2003 02:53:47 +0100, "Hero Home.se"

> > >Did a little change added As Long
> > > Declare Function MBR_MBRUnload Lib "mbrplay.dll" Alias

> > >In Form_Unload I do dim tmp, tmp = MBR_MBRUnload()
> > >Now I don't get the error msg, but closing the app also closes the ide
> > >??
> > It closes the IDE because it crashes VB.
> > Btw, you should always Dim to the type that is expected by APIs, they
> > are very touchy about these things. That should be Dim tmp As Long.
> > Although in the previous post you said that the C declaration is :
> > void MBR_MBR_Unload(), so this fnction does not return, hence it
> > should be declared as a Sub in VB.
> > Have you tried with the Sub ?

> > >Must be some bad function in the dll, or?
> > >I have contacted the author, but as almost always answeres are slow. And
>  as
> > >usual (at least for me) the app should have been ready a couple of weeks
>  ago
> > >:-((

> > Dam {*filter*}y programmers, they're all alike.. ;-)

> > --
> > Happy 2003 !

> > Regards, Frank
> Some kind of weird more or less human look-alikes 8>()
> Tryed declare as a sub, no difference, ide still closes. Have to use it as
> this till I get an answere from the source. Lyckily my user doesn't run it
> in the ide...
> Thanx 4 trying, I'll report when it is solved if ever....
> Sincerely /Henning



Mon, 04 Jul 2005 05:49:12 GMT  
 Bad DLL calling covention '49'
I can't see the rest of the thread, so forgive me if this has been brought
up before, but does this function use the __stdcall calling convention?  If
it does not then that would account for the error 49 - this error is VB's
polite way of telling you that you just trashed the stack.  VB.CLASSIC can
not use the default __cdecl by default.  There are ugly hacks for making
this work in VB.CLASSIC (for a good discussion on this topic and a
relatively nicely packaged solution, I would grab a copy of Mat Curland's
"Advance Visual Basic 6").

Tom Shelton

PS:  If you ever move to VB.NET, you will be delighted to find out that it
supports both stdcall and cdecl (as well as several other calling
conventions)...

Class Player
    <DllImport("mbrplay.dll", _

        CallingConvention:=CallingConvention.Cdecl)> _
    Shared Sub MBR_MBRUnload()
        ' Empty body - call is redirected to unmanaged dll
    End Sub

    Public Shared Function Main(Args() As String) As Integer
        Player.MBR_MBUnload()
        Return 0
    End Sub
End Class

HTH,
Tom Shelton


Quote:



> > On Tue, 7 Jan 2003 02:53:47 +0100, "Hero Home.se"

> > >Did a little change added As Long
> > > Declare Function MBR_MBRUnload Lib "mbrplay.dll" Alias

> > >In Form_Unload I do dim tmp, tmp = MBR_MBRUnload()
> > >Now I don't get the error msg, but closing the app also closes the ide
> > >??
> > It closes the IDE because it crashes VB.
> > Btw, you should always Dim to the type that is expected by APIs, they
> > are very touchy about these things. That should be Dim tmp As Long.
> > Although in the previous post you said that the C declaration is :
> > void MBR_MBR_Unload(), so this fnction does not return, hence it
> > should be declared as a Sub in VB.
> > Have you tried with the Sub ?

> > >Must be some bad function in the dll, or?
> > >I have contacted the author, but as almost always answeres are slow.
And
> as
> > >usual (at least for me) the app should have been ready a couple of
weeks
> ago
> > >:-((

> > Dam {*filter*}y programmers, they're all alike.. ;-)

> > --
> > Happy 2003 !

> > Regards, Frank
> Some kind of weird more or less human look-alikes 8>()
> Tryed declare as a sub, no difference, ide still closes. Have to use it as
> this till I get an answere from the source. Lyckily my user doesn't run it
> in the ide...
> Thanx 4 trying, I'll report when it is solved if ever....
> Sincerely /Henning



Mon, 04 Jul 2005 13:28:33 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Run-time error '49': Bad DLL calling convention

2. Call dll gives error 49 but shouldn't

3. Possible answer to Err 49: Bad DLL calling convention

4. Possible answer to Err 49: Bad DLL calling convention

5. Access200 - Error 49: "Bad DLL calling..."

6. Bad DLL calling convention (error 49)

7. Error 49: Bad Dll Calling convention

8. Help Re: error 49 Bad DLL calling convention

9. Error 49 -- Bad DLL Calling Convention

10. RunTime 49: Bad DLL Calling Convention

11. error 49 - bad dll calling convention

12. Homemade DLL gets 'Bad DLL calling convention' (Error 49) in VB 5.0

 

 
Powered by phpBB® Forum Software