Re: __stdcall not recognized
Posted by
Wade Walker on
Jun 18, 2011; 9:04pm
URL: https://forum.jogamp.org/stdcall-not-recognized-tp3079928p3080779.html
Hi Dino,
It looks like you might have to modify gluegen's C grammar slightly to make this work. If you check out the source and look in gluegen/src/java/com/jogamp/gluegen/cgram, you can see the ANTLR grammar files there (the *.g files). Inside HeaderParser.g and StdCParser.g, you can see the definitions for the functionDef and functionDeclSpecifiers grammar rules don't include any mention of __stdcall (since this is a Microsoft-specific extension).
To fix it quick and dirty, you should be able to simply add __stdcall something like this:
functionDef {
TypeBox tb = null;
}
: #( NFunctionDef
( functionDeclSpecifiers)?
declarator[tb]
("__stdcall")?
(declaration | VARARGS)*
compoundStatement
)
;
I'm not quite sure where it goes in the grammar rule -- you might have to poke around a bit and make sure. And it may also need to go in other occurrences of functionDef in other *.g files.
Once you've fixed the grammar, recompile gluegen (making sure the ANTLR parser generation step doesn't throw any errors) and test it out on your input file.
To fix this "for real", you'd probably need to do what they've done for GNU C -- create a new .g file for MS C and just override the parts of the grammar that are different. See the GnuC*.g files for an example.