Skip to content

MallocString or StaticString from a simple string #156

Open
@Thomas008

Description

Hi,
I try to get copmiled abspath() or pwd(). Therefore it would be great, if it possibe to construct a MallocString or StaticString from a "simple" Julia string. Is this possible?

The following function can be compiled:

function f()
      a = @c_str("e")
      b = @m_str("e")
      println(a)
      println(b)
      0
end

using
compile_executable(b, (), "C:\\jul\\staticcompiler")

But as soon I use a local variable for the macro, I get LLVM IR errors when compiling:

function f()
      a = "r"
      @c_str(a)
      0
 end

The same negative result I get from using the constructors StaticString and MallocString:

function f()
      b = MallocString("r")
      0
end
function f()
     b = StaticString("r")
     0
 end

In the test suites I don't find an example for constructing a MallocString or StaticString out from a String.

Do you have any ideas to get compiled constucting a MallocString or StaticString from a String?

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