jaeandersson / swig

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.
http://www.swig.org
Other
23 stars 19 forks source link

test-suite: import_nomodule.i fails #98

Open KrisThielemans opened 3 years ago

KrisThielemans commented 3 years ago
swig -Wall -python -c++ .\import_nomodule.i
.\import_nomodule.i(37) : Warning 401: Base class 'Foo' ignored - unknown module name for base. Either import the appropriate module interface file or specify the name of the module in the %import directive.

@wsfulton answered on the mailing list

Looks like it is testing partially provided type information. This is something that SWIG does support (unlike a C++ compiler). In this case, the %import provides the appropriate type information in order for the runtime system to work fairly well. That is, the test1 function:

void test1(Foo*, Integer);

will accept a Bar * (Bar is derived from Foo) even though there are no proxy classes generated for this class hierarchy. This works in the scripting languages that support the SWIG runtime system, but cannot work for the statically typed languages (like Java) because there is no SWIG runtime system in these languages. Whether or not this test should be supported for MATLAB does of course depend on whether or not MATLAB has implemented the SWIG runtime system.