Compile and link C/C++ libs automatically
bachmeier
no at spam.net
Thu Dec 3 12:38:58 UTC 2020
On Thursday, 3 December 2020 at 09:10:53 UTC, Robert M. Münch
wrote:
> On 3 Dec 2020 at 06:08:55 CET, "RSY" <rsy_881 at gmail.com> wrote:
>
>> However, one feature that is making me very jealous was the
>> ability to compile c/c++ code and automatically link the lib,
>> and cache all that
>>
>> This made working with C libraries MUCH easier ...
>> Now imagine such feature, with DUB
>
> Go make it even simpler and IMO that's the way to go:
>
> // <myinclude.>
> Import "C"
>
> And now use all your C functions and structs, etc.
>
> That's the way to go. No extra tool, no pre-step conversion, no
> fiddling around with separate files.
>
> Just simple, straight import and you are done.
I assume you're referring to cgo. I honestly don't see how that's
any easier than using dpp. It's been quite a few years now, but
cgo was what attracted me to an otherwise bland language - I
thought it would make it easy to solve my problems. cgo has its
limitations (or maybe they are limitations of the language
itself, I'm not sure). My recollection is that I gave up after a
painful attempt trying to pass function pointers. Some
limitations are listed here: https://golang.org/cmd/cgo/ For
instance, "Go struct types are not supported; use a C struct
type. Go array types are not supported; use a C pointer."
Overall the experience wasn't what I had hoped. Just to be clear,
I'll repeat that I haven't used Go in ages, but "simple, straight
import and you are done" was not my experience when I used cgo.
More information about the Digitalmars-d
mailing list