diff --git a/src/Generator/Passes/FunctionToStaticMethodPass.cs b/src/Generator/Passes/FunctionToStaticMethodPass.cs index e714e429..81ae5dec 100644 --- a/src/Generator/Passes/FunctionToStaticMethodPass.cs +++ b/src/Generator/Passes/FunctionToStaticMethodPass.cs @@ -26,12 +26,18 @@ namespace CppSharp.Passes if (@class == null) return false; + // TODO: If the translation units of the declarations are different, + // and we apply the pass, we might need additional includes in the + // generated translation unit of the class. + if (@class.TranslationUnit != function.TranslationUnit) + return false; + // Clean up the name of the function now that it will be a static method. var name = function.Name.Substring(@class.Name.Length); function.ExplicityIgnored = true; // Create a new fake method so it acts as a static method. - var method = new Method() + var method = new Method { Namespace = @class, OriginalNamespace = function.Namespace,