Mr. Muskrat has asked for the wisdom of the Perl Monks concerning the following question:

Highly Esteemed Monks,

I have stumbled upon an error that I have not seem mentioned anywhere. I did a Super Search as well as a Google but I haven't found anything. When I use the Win32 and Win32::GUI modules together, I get prototype mismatch errors. I am using ActiveState Perl 5.6.1 build 633 on Windows 98.

Sample code:

#!/usr/bin/perl use strict; # with or without this use warnings; # with or without this use Win32; use Win32::GUI;

I end up with warning upon warning:

Prototype mismatch: sub main::MB_ICONEXCLAMATION () vs none at C:/Perl +/lib/Exporter.pm line 57. Exporter::import('BS_3STATE', 'BS_AUTO3STATE', 'BS_AUTOCHECKBOX', 'BS_ +AUTORADIOBUTTON', 'BS_CHECKBOX', 'BS_DEFPUSHBUTTON', 'BS_GROUPBOX', 'BS_LEFTTEXT', ...) +called at test.pl line 5 main::BEGIN() called at C:/Perl/site/lib/Win32/GUI.pm line 5 eval {...} called at C:/Perl/site/lib/Win32/GUI.pm line 5 Prototype mismatch: sub main::MB_ICONWARNING () vs none at C:/Perl/lib +/Exporter.pm line 57. Exporter::import('BS_3STATE', 'BS_AUTO3STATE', 'BS_AUTOCHECKBOX', 'BS_ +AUTORADIOBUTTON', 'BS_CHECKBOX', 'BS_DEFPUSHBUTTON', 'BS_GROUPBOX', 'BS_LEFTTEXT', ...) +called at test.pl line 5 main::BEGIN() called at C:/Perl/site/lib/Win32/GUI.pm line 5 eval {...} called at C:/Perl/site/lib/Win32/GUI.pm line 5 Prototype mismatch: sub main::MB_ICONINFORMATION () vs none at C:/Perl +/lib/Exporter.pm line 57. Exporter::import('BS_3STATE', 'BS_AUTO3STATE', 'BS_AUTOCHECKBOX', 'BS_ +AUTORADIOBUTTON', 'BS_CHECKBOX', 'BS_DEFPUSHBUTTON', 'BS_GROUPBOX', 'BS_LEFTTEXT', ...) +called at test.pl line 5 main::BEGIN() called at C:/Perl/site/lib/Win32/GUI.pm line 5 eval {...} called at C:/Perl/site/lib/Win32/GUI.pm line 5 Prototype mismatch: sub main::MB_ICONASTERISK () vs none at C:/Perl/li +b/Exporter.pm line 57. Exporter::import('BS_3STATE', 'BS_AUTO3STATE', 'BS_AUTOCHECKBOX', 'BS_ +AUTORADIOBUTTON', 'BS_CHECKBOX', 'BS_DEFPUSHBUTTON', 'BS_GROUPBOX', 'BS_LEFTTEXT', ...) +called at test.pl line 5 main::BEGIN() called at C:/Perl/site/lib/Win32/GUI.pm line 5 eval {...} called at C:/Perl/site/lib/Win32/GUI.pm line 5 Prototype mismatch: sub main::MB_ICONQUESTION () vs none at C:/Perl/li +b/Exporter.pm line 57. Exporter::import('BS_3STATE', 'BS_AUTO3STATE', 'BS_AUTOCHECKBOX', 'BS_ +AUTORADIOBUTTON', 'BS_CHECKBOX', 'BS_DEFPUSHBUTTON', 'BS_GROUPBOX', 'BS_LEFTTEXT', ...) +called at test.pl line 5 main::BEGIN() called at C:/Perl/site/lib/Win32/GUI.pm line 5 eval {...} called at C:/Perl/site/lib/Win32/GUI.pm line 5 Prototype mismatch: sub main::MB_ICONSTOP () vs none at C:/Perl/lib/Ex +porter.pm line 57. Exporter::import('BS_3STATE', 'BS_AUTO3STATE', 'BS_AUTOCHECKBOX', 'BS_ +AUTORADIOBUTTON', 'BS_CHECKBOX', 'BS_DEFPUSHBUTTON', 'BS_GROUPBOX', 'BS_LEFTTEXT', ...) +called at test.pl line 5 main::BEGIN() called at C:/Perl/site/lib/Win32/GUI.pm line 5 eval {...} called at C:/Perl/site/lib/Win32/GUI.pm line 5 Prototype mismatch: sub main::MB_ICONERROR () vs none at C:/Perl/lib/E +xporter.pm line 57. Exporter::import('BS_3STATE', 'BS_AUTO3STATE', 'BS_AUTOCHECKBOX', 'BS_ +AUTORADIOBUTTON', 'BS_CHECKBOX', 'BS_DEFPUSHBUTTON', 'BS_GROUPBOX', 'BS_LEFTTEXT', ...) +called at test.pl line 5 main::BEGIN() called at C:/Perl/site/lib/Win32/GUI.pm line 5 eval {...} called at C:/Perl/site/lib/Win32/GUI.pm line 5 Prototype mismatch: sub main::MB_ICONHAND () vs none at C:/Perl/lib/Ex +porter.pm line 57. Exporter::import('BS_3STATE', 'BS_AUTO3STATE', 'BS_AUTOCHECKBOX', 'BS_ +AUTORADIOBUTTON', 'BS_CHECKBOX', 'BS_DEFPUSHBUTTON', 'BS_GROUPBOX', 'BS_LEFTTEXT', ...) +called at test.pl line 5 main::BEGIN() called at C:/Perl/site/lib/Win32/GUI.pm line 5 eval {...} called at C:/Perl/site/lib/Win32/GUI.pm line 5

Am I the only one this happens to?

Replies are listed 'Best First'.
Re: Prototype mismatch
by BrowserUk (Patriarch) on Sep 26, 2002 at 18:31 UTC

    Yes. The problem is that both modules are autoexporting the same constants. One way around this is to disable the autoexport like this.

    #!/usr/bin/perl use strict; # with or without this use warnings; # with or without this use Win32; use Win32::GUI (); # Prevents autoexport for this module.

    You can put the empty quotes on either of the calls to prevent the warnings.

    Of course this means that you will then need to explicitly request exporting of everything you need from that module.

    You should probably check the sources of the modules to verify that the duplicated constants are indeed the same, but in the past I have found this quite a difficult process.


    Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!

      Wow. So simple!

      I really should have known that! I thank you for answering so quickly.