Forums
Inline CIL-assembler
2 posts
• Page 1 of 1
Inline CIL-assembler
Is it possible? If no, I am satisfied with any less-level (compared to Cobra) language: C, C++, and even the C#.
It is easy to go from the house of reality to the forest of mathematics, but only few know how to go back. Hugo Steinhaus.
- Zmeeed
- Posts: 13
- Location: Russia
Re: Inline CIL-assembler
We have "C# strings" which can be used wherever an expression is expected:
The sharp string contents get passed to the C# back-end compiler as-is. Since Cobra does not understand the contents, it's not uncommon to provide a type cast like you see above ("to int").
Sharp strings are primarily an escape hatch for when we need a workaround for some issue. If you find yourself needing this, let me know. Maybe there is a Cobra way or maybe Cobra needs improvement.
If you're looking for dynamic, run-time code gen, look for the open source Cecil library.
s = 'cobra'
n = sharp's.Length * 2' to int
trace n
The sharp string contents get passed to the C# back-end compiler as-is. Since Cobra does not understand the contents, it's not uncommon to provide a type cast like you see above ("to int").
Sharp strings are primarily an escape hatch for when we need a workaround for some issue. If you find yourself needing this, let me know. Maybe there is a Cobra way or maybe Cobra needs improvement.
If you're looking for dynamic, run-time code gen, look for the open source Cecil library.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 39 guests