Comments (4)
@johnhilts
Yep, that's the way to do it.
@PersonalityEngineer
Also, consider using included custom syntax.
(named-readtables:in-readtable bike:bike-syntax)
;; change %SubObject to $SubObject in case if that is a field not a property
(let ((ob (new 'SomeObject)))
[[[ob %SubObject] %SubObject2] Method "data"])
Also an example on using a .Net float or string array (unboxing?) would be fantastic.
bike provides a generic way to access any array with dnaref
and (setf dnaref)
functions, e.g.
(let ((v (new '(array :float) 123)))
(setf (dnaref v 0) 123.0s0)
(dnaref v 0))
However, bike also allows to use pinned
objects, so that you can access their memory directly (for ex. using cffi)
(let ((vector (new '(array :int) 10)))
(with-fixed (ptr vector)
(dotimes (i 10)
(setf (cffi:mem-aref ptr :int i) (1+ i))))
from bike.
I think you can do it with a combination of bike:property
and bike:invoke
.
Here's what I did:
using System;
namespace MyNamespace
{
public class InnerClass
{
public string GetInfo()
{
return "This is from the inner class!";
}
}
public class OuterClass
{
public OuterClass ()
{
this.Inner = new InnerClass();
}
public InnerClass Inner {get; set;}
public string GetInfo()
{
return "This is from the outer class!";
}
public int GetNumber()
{
return 1234;
}
}
}
Then in Lisp, I did this:
;; in SLIME
BIKE-EXAMPLES> (let ((the-outer-ojbect (new 'OuterClass)))
(invoke (property the-outer-ojbect 'Inner) 'GetInfo))
=> "This is from the inner class!"
from bike.
Didn't know about dnaref
- very handy :)
(dnaref (invoke (invoke 'Enumerable 'Range 1 10) 'ToArray) 1)
=> 2
from bike.
Finally, here are the docs: https://github.com/Lovesan/bike/blob/master/doc/README.md
from bike.
Related Issues (17)
- SBCL crashes while .Net is here HOT 6
- Does not build - type issue HOT 4
- ByRef parameters for public APIs
- reflection-property does not work for COM objects HOT 1
- executable on Windows 10 dumps into ldb HOT 5
- Questions HOT 1
- Exception handling on Windows should be saner now HOT 2
- error HOT 2
- Quickload error HOT 8
- Unable to load foreign library (CORECLR). (on Windows 10) HOT 8
- Quickload install error HOT 1
- Expanded example for WPF HOT 10
- WPF example suggestions
- Using dotnet the FreeBSD + the frank dotnet crossbuild + bike, produces "error unable to get executable name error" HOT 1
- gentoo sbcl + bike broken. HOT 1
- Some systems failed to build for Quicklisp dist
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bike.