Skip to content

Instantly share code, notes, and snippets.

@MrSmith33
Created October 10, 2017 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrSmith33/dc53d8cb6ce642fcb6dbc5863d029cec to your computer and use it in GitHub Desktop.
Save MrSmith33/dc53d8cb6ce642fcb6dbc5863d029cec to your computer and use it in GitHub Desktop.
unresolved external symbol internal. (Smaller test case)
// dmd -m64 -lib -of="lib.lib" -debug -g -w -I="./" texteditor.d
// dmd -m64 -of="app.exe" -debug -g -w -I="./" lib.lib main.d
import texteditor;
void main() {}
module texteditor;
class EditorTextModel
{
TextEditor* editor;
ChunkedRange!char opSlice(size_t from, size_t to) { return editor.textData[from..to].toChunkedRange; }
void replaceSelection(const(char)[] str) { editor.replaceSelection(str); }
}
struct TextEditor
{
private PieceTable textData;
mixin ReadHelpers!();
mixin WriteHelpers!();
}
mixin template ReadHelpers()
{
import std.datetime : MonoTime;
}
mixin template WriteHelpers()
{
void replaceSelection(const(char)[] str) {}
}
private struct Piece { size_t bufferOffset; }
struct PieceRestoreRange {}
private struct PieceStorage
{
Piece* sentinel = new Piece;
PieceRestoreRange insertAt(Piece* newPiece, size_t insertPos)
{
return PieceRestoreRange();
}
}
struct PieceTable
{
PieceStorage pieces;
Range!char opSlice(size_t x, size_t y) { return Range!char(); }
size_t length() @property { return 0; }
}
private struct Range(T)
{
ChunkedRange!char toChunkedRange() { return ChunkedRange!char(); }
}
struct ChunkedRange(T) { size_t itemsLeft; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment