yzhikan / npapi-sdk

Automatically exported from code.google.com/p/npapi-sdk
0 stars 0 forks source link

Fix a calling convention of NPN_* function pointers #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile with gcc446
2.
3.

What is the expected output? What do you see instead?
Compilation without error, but error occurs due to a calling convention

What operating system are you compiling on?
OS/2

Please provide any additional information below.
NP_CALLBACK should be used

Original issue reported on code.google.com by kom...@gmail.com on 14 Jul 2012 at 4:37

Attachments:

GoogleCodeExporter commented 9 years ago
Ping ?

Original comment by kom...@gmail.com on 21 Jul 2012 at 1:46

GoogleCodeExporter commented 9 years ago
Why don't you use NP_LOADDS again instead of defining a new macro, NP_CALLBACK?

Original comment by josh...@gmail.com on 23 Jul 2012 at 8:48

GoogleCodeExporter commented 9 years ago
NP_CALLBACK is already being used in mozilla/dom/plugins/nsNPAPIPlugin.h and 
nsNPAPIPlugin.cpp.

And I moved it from nsNPAPIPlugin.h

Original comment by kom...@gmail.com on 24 Jul 2012 at 3:25

GoogleCodeExporter commented 9 years ago
Please just use NP_LOADDS. We don't need to worry about what nsNPAPIPlugin does 
here, no need for NP_CALLBACK.

Original comment by josh....@gmail.com on 24 Jul 2012 at 5:11

GoogleCodeExporter commented 9 years ago
Ok, I've replaced NP_CALLBACK with NP_LOADDS.

If so, we should change nsNPAPIPlugin accordingly to this, later ?

Original comment by kom...@gmail.com on 25 Jul 2012 at 1:54

Attachments:

GoogleCodeExporter commented 9 years ago
I'm happy with this patch, let's get a look from Stuart Morgan as well though. 
Stuart?

No need to change the Mozilla code here.

Original comment by josh....@gmail.com on 25 Jul 2012 at 1:49

GoogleCodeExporter commented 9 years ago
I'm not at all familiar with OS/2; what does _System do, and what's the compile 
error this fixes?

Original comment by stuart.morgan on 26 Jul 2012 at 8:00

GoogleCodeExporter commented 9 years ago
_System is the calling convention used for a DLL entry.

And this patch fixes the following case.

----- call.cpp
typedef int (*fnTest)( int, int );

int _System test( int a, int b )
{
    return a + b;
}

int main( void )
{
    fnTest fn = test;

    return fn(10, 10);
}
-----

g++ -c call.cpp generates the following error.

-----
call.cpp: In function 'int main()':
call.cpp:10: error: invalid conversion from 'int (*)(int, int)' to 'int 
(*)(int, int)'
-----

Original comment by kom...@gmail.com on 27 Jul 2012 at 4:34

GoogleCodeExporter commented 9 years ago
Ping ?

Original comment by kom...@gmail.com on 31 Jul 2012 at 6:46

GoogleCodeExporter commented 9 years ago
LGTM (although I'm wondering why in all the time the OS/2 define has been 
there, this has never come up before).

As a side note, yay gcc for it's oh-so-helpful error messages.

Original comment by stuart.morgan on 12 Aug 2012 at 6:32

GoogleCodeExporter commented 9 years ago
Committed.

Original comment by josh....@gmail.com on 13 Aug 2012 at 7:05