Search code examples
gocgo

Is there a way to pass a TagLib::PropertyMap to Go?


I'm trying to get the values from TagLib::PropertyMap into Go. I've seen some ways that work in getting the values by looping over k/v pairs but is that the most efficient way to do that? Shouldn't I just be able to return PropertyMap from C++ and cast to a map[string]string?


Solution

  • Shouldn't I just be able to return PropertyMap from C++ and cast to a map[string]string?

    No, of course not:

    1. There are no casts in Go, only type conversions.

    2. The PropertyMap type of C++ and Go's map type are completely different so you cannot type convert them.

    3. Even if you could type convert the map types: The string type of C++ and Go are completely different.