Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MallocString or StaticString from a simple string #156

Open
Thomas008 opened this issue Mar 21, 2024 · 1 comment
Open

MallocString or StaticString from a simple string #156

Thomas008 opened this issue Mar 21, 2024 · 1 comment

Comments

@Thomas008
Copy link
Contributor

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?

@brenhinkeller
Copy link
Collaborator

brenhinkeller commented Mar 21, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants