Skip to content

Modules Not Laid Out Properly #13

@rmerriam

Description

@rmerriam

My guess is that the modules are not laid out correctly. Rewriting them to test this assertion would take a lot of work. They work this way, but it isn't optimal.

Here is Snapshot.cppm.

module;

export module spectrum:Snapshot;

import peripherals;
import z80_common;

#include "spectrum/Snapshot.hpp"

#include "Snapshot.cpp"

The translation unit Snapshot.cpp should be a Module Implementation Unit, not included in the Module Interface Unit (MIU). The same is true of Spectrum.cppm and Spectrum.hpp. This pattern occurs throughout the code. I can understand why this approach was used since it is a straightforward way of converting the library to modules.

An MIU should not have any code; if it does, it should be in a private fragment. That is only valid, IMHO, for trivial code.

I cannot explain why this would cause so much relinking. Sorry I couldn't be more helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions