MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / AddPointer

Method AddPointer

fem/code_generation.cpp:49–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 }
48
49 string Code::AddPointer(const void *p, string name, string type, string qualifiers)
50 {
51 if(name == "")
52 name = "compiled_code_pointer" + ToString(id_counter++);
53 top += "extern \"C\" " + qualifiers + " " + type + " " + name + ";\n";
54 stringstream s_ptr;
55#ifdef WIN32
56 s_ptr << "0x";
57#endif
58 s_ptr << std::hex << p;
59 string value_expression = s_ptr.str();
60 if(type.find('*') != string::npos)
61 value_expression = "reinterpret_cast<" + type + ">(" + value_expression + ")";
62 pointer += "[[maybe_unused]] " + qualifiers + " " + type + " " + name + " = " + value_expression + ";\n";
63 return name;
64 }
65
66 void Code :: Declare (string type, int i, FlatArray<int> dims)
67 {

Callers 4

GenerateCodeMethod · 0.80
GenerateCodeMethod · 0.80
GenerateCodeMethod · 0.80

Calls 2

ToStringFunction · 0.85
findMethod · 0.80

Tested by

no test coverage detected