@@ -23,7 +23,7 @@ void CodeGenerator::generateHeader(const std::vector<InterfaceInfo> &interfaces,
2323
2424 // Generate header guard using just the filename (not full path)
2525 std::filesystem::path filepath (filename);
26- std::string guard = " GENERATED_" + sanitize_identifier (filepath.filename ().string ()) + " _HPP " ;
26+ std::string guard = " GENERATED_" + sanitize_identifier (filepath.filename ().string ());
2727 std::transform (guard.begin (), guard.end (), guard.begin (), ::toupper);
2828
2929 out << " #pragma once\n\n " ;
@@ -123,9 +123,10 @@ void CodeGenerator::generateHeader(const std::vector<InterfaceInfo> &interfaces,
123123 }
124124 else
125125 {
126- // Interface not found in registry - generate placeholder comment
127- out << " // External interface not loaded: " << import << " \n " ;
128- out << " // Host must provide implementations for functions from this interface\n " ;
126+ // Interface not found in registry - this is an error
127+ throw std::runtime_error (" External interface not loaded: " + import +
128+ " \n Package '" + package_spec + " ' interface '" + interface_name +
129+ " ' was not found in the registry. Make sure to load all dependent packages before generating code." );
129130 }
130131 }
131132 else
@@ -190,9 +191,10 @@ void CodeGenerator::generateHeader(const std::vector<InterfaceInfo> &interfaces,
190191 }
191192 else
192193 {
193- // Interface not found in registry - generate placeholder comment
194- out << " // External interface not loaded: " << export_name << " \n " ;
195- out << " // Guest must implement functions from this interface\n " ;
194+ // Interface not found in registry - this is an error
195+ throw std::runtime_error (" External interface not loaded: " + export_name +
196+ " \n Package '" + package_spec + " ' interface '" + interface_name +
197+ " ' was not found in the registry. Make sure to load all dependent packages before generating code." );
196198 }
197199 }
198200 else
0 commit comments