FAQ
Hi,

I need to add a module to a large code (100k ish lines) which is written in
C++. My module is non-trivial, and I think a number of the features of Go
will help with its development. (Plus, Go is way more fun than C++). The
interface between my module and the big code can be reduced to passing
several arrays of floats to my module, and then several different arrays
back to the c++ module (100K - 1000k floats total, and this needs to happen
hundreds of times, thus I would like to avoid file i/o). I can use cgo to
create my module, and then import it in c++ with an extern command,
correct? I have not used extern commands in c or c++ and so while it
doesn't seem like there should be any issues, I thought I would ask the
list. I didn't see any comments in the cgo documentation about possible
issues with c++ or lack thereof.

Thanks

--
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 golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Minux at Feb 14, 2013 at 10:04 am

    On Thu, Feb 14, 2013 at 5:03 PM, Brendan Tracey wrote:

    I need to add a module to a large code (100k ish lines) which is written
    in C++. My module is non-trivial, and I think a number of the features of
    Go will help with its development. (Plus, Go is way more fun than C++).
    The interface between my module and the big code can be reduced to passing
    several arrays of floats to my module, and then several different arrays
    back to the c++ module (100K - 1000k floats total, and this needs to happen
    hundreds of times, thus I would like to avoid file i/o). I can use cgo to
    create my module, and then import it in c++ with an extern command,
    correct? I have not used extern commands in c or c++ and so while it
    doesn't seem like there should be any issues, I thought I would ask the
    list. I didn't see any comments in the cgo documentation about possible
    issues with c++ or lack thereof.
    i'm afraid that c++ is not supported by cgo at the moment, so you need to
    use
    swig.
    take a look at here:
    http://www.swig.org/Doc2.0/SWIGDocumentation.html#Go

    you will need to use Go tip (the upcoming Go 1.1) for seamless Go tool
    support.

    --
    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 golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 14, '13 at 9:03a
activeFeb 14, '13 at 10:04a
posts2
users2
websitegolang.org

2 users in discussion

Minux: 1 post Brendan Tracey: 1 post

People

Translate

site design / logo © 2022 Grokbase