>>yes, Is there any library code in golang that helps me to read out
interface{}'s type information?
Yes, there is https://golang.org/pkg/reflect
For example:
getType(0)
getType("hello string")
func getType(v interface{}){
t := reflect.TypeOf(v)
fmt.Printf("type is %s", t)
}
On Tuesday, April 9, 2024 at 2:04:01 AM UTC+3 Carl-Philip Hänsch wrote:
> Hi,
>
> I am currently developing a JITable interpreter for a scripting language
> where users can define user-defined functions with the signature
>
> func (...interface{}) interface{}
>
> that can interoperate with the scripts. interface{} can be bool, int,
> string, []interface{} or another func(...interface{}) interface{} or one of
> many more.
>
> Now I want to create a C/C++ library that offers additional functions with
> exactly this signature. My questions:
>
> - interface{} is represented as a value (ptruint) and a type
> information pointer. Is there a way to somehow pass this information to
> C/C++?
> - Does C/C++ (more specific: LLVM) have a calling convention that is
> ABI compatible to golang? (so I can use interface{} as a pair of
> parameters?)
> - Is there any library code in golang that helps me to read out
> interface{}'s type information?
>
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/c0f20438-989c-4276-b82d-8c3861697c80n%40googlegroups.com.