Skip to content
This repository was archived by the owner on Jan 6, 2018. It is now read-only.
This repository was archived by the owner on Jan 6, 2018. It is now read-only.

Send string as function parameter from Go to C++ #1

Open
@pbandyop

Description

@pbandyop

Hi,
first it is a very nice example.

Your project works fine if I send integer as parameter in my C++ function. I want to send a string from Go to C++ like:
C.Free("hello"))
then what should I define in my header file. Currently, I tried this:

`#ifndef MY_PACKAGE_FOO_H

define MY_PACKAGE_FOO_H

include

ifdef __cplusplus

extern "C" {

endif

cv::string Free(cv::string len);

ifdef __cplusplus

}

endif

endif`

but I get the following error:

could not determine kind of name for C.Free

clang errors for preamble:
In file included from ./foo.go:5:
./foo.h:10:4: error: expected ';' after top level declarator
cv::string Free(cv::string len);
^
;
./foo.h:10:5: error: expected identifier or '('
cv::string Free(cv::string len);
^
2 errors generated.

where cv::string Free(cv::string len); is my only C++ function in my *.cpp file. Could you suggest anything?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions