Forums

Inline CIL-assembler

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Inline CIL-assembler

Postby Zmeeed » Fri Feb 03, 2012 11:55 pm

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

Postby Charles » Sat Feb 04, 2012 12:16 am

We have "C# strings" which can be used wherever an expression is expected:
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


Return to Discussion

Who is online

Users browsing this forum: No registered users and 39 guests