FAQ
I'd also be happy to have a simplified C "ABI" calling support without the
need of C compiler and additional boilerplate code.
Something like Julia's *ccall* would be great, but I am afraid that it's
impossible for Go since it requires macros and compile-time code generation
AFAICT.

In Go, the API I would expect looks like:

cqsort := cabi.New("libc", "qsort")
or
cqsort := cabi.New("libc", "qsort", a_slice_supplied_as_call_stack)

The type signature of the Call method is like
func (c *ctx) Call(args ...int) int
or
func (c *ctx) Call(args ...interface{}) int

And the usage is like
cqsort.Call(base, count, size, mycomp)

The "Call" method will have interactions with the scheduler and therefore
be slower

Then we can have a fast version of Call without interactions with the
scheduler:

func (c *ctx) Fastcall(args ...int) int
or
func (c *ctx) NonBlockingCall(args ...int) int



Please bear in mind I do not have broad/deep knowledge about programming
language design and Go's internals so these are just thoughts from a user's
perspective.

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 12 of 13 | next ›
Discussion Overview
groupgolang-dev @
categoriesgo
postedMar 23, '16 at 9:32p
activeMar 24, '16 at 8:34a
posts13
users7
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase