From: k. h. <kla...@nl...> - 2006-01-04 13:15:16
|
Hi John, I think we need something extra to make things work for derived classes. The problem is this. I have a luawraps library, which is based on the (simplified here ) luawraps.i file. Most of it is a sort of forward declaration to parse things which come later. a2dLuaWrapper derived from a2dCanvasCsPlWrapper -> a2dCsPlWrapper a2dCentralCanvasCommandProcessor used as pointer. a2dDocumentCommandProcessor used as pointer. Those classes are not used directly for wrapping here. Wihout them genwxbind.bat does report unknown types. //Forward declaration in order to get a2dLuaWrapper parsed correctly %class %delete %noclassinfo %encapsulate a2dDocumentCommandProcessor a2dDocumentCommandProcessor() %endclass //Forward declaration in order to get a2dLuaWrapper parsed correctly %class %delete %noclassinfo %encapsulate a2dCsPlWrapper a2dCsPlWrapper(a2dDocumentCommandProcessor* commandProcessor) %endclass //Forward declaration in order to get a2dLuaWrapper parsed correctly %class %delete %noclassinfo %encapsulate a2dCentralCanvasCommandProcessor a2dCentralCanvasCommandProcessor() %endclass //Forward declaration in order to get a2dLuaWrapper parsed correctly %class %delete %noclassinfo %encapsulate a2dCanvasCsPlWrapper, a2dCsPlWrapper a2dCanvasCsPlWrapper( a2dCentralCanvasCommandProcessor* commandProcessor ) %endclass %class %delete %noclassinfo %encapsulate a2dLuaWrapper, a2dCanvasCsPlWrapper %define %pointer a2dLuaWP a2dLuaWrapper( a2dCentralCanvasCommandProcessor* commandProcessor ) bool FileOpen( const wxString& path ); %endclass Still this will all work, the problem start in an wxArt2D application, where more luabindings are added. That application has a gedi.i file which needs to contain the same "forward" declarations to make it parse. %class %delete %noclassinfo %encapsulate a2dDocumentCommandProcessor a2dDocumentCommandProcessor() %endclass %class %delete %noclassinfo %encapsulate a2dCsPlWrapper a2dCsPlWrapper(a2dDocumentCommandProcessor* commandProcessor) %endclass %class %delete %noclassinfo %encapsulate a2dCentralEditorCommandProcessor a2dCentralEditorCommandProcessor() %endclass %class %delete %noclassinfo %encapsulate a2dCanvasCsPlWrapper, a2dCsPlWrapper a2dCanvasCsPlWrapper( a2dCentralEditorCommandProcessor* commandProcessor ) %endclass %class %delete %noclassinfo %encapsulate TetoLuaWrapper, a2dCanvasCsPlWrapper %define %pointer a2dGedi TetoLuaWrapper( a2dCentralEditorCommandProcessor* commandProcessor ) bool FileExport( const wxString& path, const wxString& description, bool silent = true ) %endclass Somehow this generates code like the following twice, once for luawraps library, and one for the application. Which of course is a problem in compiling or else linking. wxLUA_DECLARE_ENCAPSULATION(a2dCentralEditorCommandProcessor) wxLUA_DECLARE_ENCAPSULATION(a2dDocumentCommandProcessor) wxLUA_DECLARE_ENCAPSULATION(TetoLuaWrapper) wxLUA_DECLARE_ENCAPSULATION(a2dCsPlWrapper) wxLUA_DECLARE_ENCAPSULATION(a2dCanvasCsPlWrapper) SO i think we need something like a forward declaration in *.i files, which does not result in code generation, but is only used by genwxbind.lua for checking/knowing types. Before we did not have this situation, since one did have one big overall info file, which used includes. But for the modular bindings we have now, we need a way to have some header mechanism, which not result in code, i think. BTW what does %encapsulate mean? What do you think? Is there a way to handle it, and i simply don't know, or is it a real problem? Thanks, Klaas -- Unclassified |