How to load GL shaders from a string?

I need to be able to load and build a GL shader from a .frag file containing the source for the shader. Since the shader will be provided post-compilation, I cannot use the currently accepted method that utilizes annotations.

However the code for this annotation appears to include a bunch of preprocessing that includes adding fields to the class.

Can these steps only be performed at compile time? Should this function’s code be split off into a utility function so that it can be called at runtime? Is there already a way of doing this that I don’t know of?

Yes, see:https://github.com/rainyt/openfl-glsl

I’ve analyzed this sample project and it does pull from a text file, but it does so at compile time.

The text of the shader has to be loaded at runtime in my case (it’s being provided by the user).

class ZShader extends DisplayObjectShader {
     public function new(glVertexSource:Stirng,glFragmentSource:String) {
           	        this.glVertexSource = glVertexSource;
			this.glFragmentSource = glFragmentSource;
                        super();
     }
}

I used to do this in HTML5, but there will be errors in C + +. You can investigate.