I want to use C ++ class from Go using swig on Windows7
When I create the project "go build main.go", I get the following error:
c: \ .. \ Temp \ go-build591352403 / swtest.a (swtest_wrap.o): malformed pe file: __cgo_topofstack: incorrect character binding 105
I am using go 1.3 32bit, gcc 4.8.1 32bit and swig 3.0 on Windows7. I see the same error when I use 64-bit Go and GCC in Windows7.
I can successfully create and run on Ubuntu with 64-bit go and gcc.
Am I missing something in the windows?
Here is the file structure and its contents.
main (folder)
swtest (folder)
swtest.cpp
#include "swtest.h"
void Swt::Print(const std::string& s)
{
std::cout << s;
std::cout << std::endl;
}
swtest.h
#ifndef SWTEST_H
#define SWTEST_H
#include <string>
#include <iostream>
class Swt
{
public:
void Print(const std::string& s);
};
#endif
swtest.go
package swtest
swtest.swigcxx
%module swtest
%include "std_string.i"
%{
#include "swtest.h"
%}
%include "swtest.h"
source
share