Get it to build from go build

This commit is contained in:
idk 2021-06-17 23:12:22 -04:00
parent 5013ce5649
commit 7bc2e74683
No known key found for this signature in database
GPG key ID: D75C03B39B5E14E1
7 changed files with 53 additions and 38 deletions

View file

@ -28,10 +28,6 @@
#include "Datagram.h"
#include "util.h"
#ifdef __cplusplus
extern "C" {
#endif
namespace i2p
{
namespace client
@ -316,8 +312,4 @@ namespace client
}
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -20,10 +20,6 @@
#include "Signature.h"
#include "CryptoKey.h"
#ifdef __cplusplus
extern "C" {
#endif
namespace i2p
{
namespace data
@ -248,8 +244,4 @@ namespace data
}
}
#ifdef __cplusplus
}
#endif
#endif

10
libi2pd/api.go Normal file
View file

@ -0,0 +1,10 @@
package api
/*
//void Go_InitI2P (int argc, char argv[], const char * appName){
//}
#cgo CPPFLAGS: -I${SRCDIR}/../i18n -I${SRCDIR}/../libi2pd_client -g -Wall -Wextra -Wno-unused-parameter -pedantic -Wno-psabi -fPIC -D__AES__ -maes
#cgo LDFLAGS: -latomic -lcrypto -lssl -lz -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread -lstdc++
*/
import "C"

View file

@ -2,14 +2,14 @@
// e.g. map std::string to Go string
%{
#include "api.h"
#include "capi.h"
//#include "Streaming.h"
#include "Destination.h"
//#include "Destination.h"
//#include "Identity.h"
//#include "Tag.h"
%}
%include "api.h"
%include "capi.h"
//%include "Streaming.h"
//%include "Destination.h"
//%include "Identity.h"

View file

@ -13,9 +13,9 @@
extern "C" {
#endif
void C_InitI2P (int argc, char* argv[], const char * appName)
void C_InitI2P (int argc, char argv[], const char * appName)
{
return i2p::api::InitI2P(argc, argv, appName);
return i2p::api::InitI2P(argc, &argv, appName);
}
void C_TerminateI2P ()
@ -25,8 +25,9 @@ void C_TerminateI2P ()
void C_StartI2P ()//std::ostream *logStream)
{
// std::shared_ptr<std::ostream> cppLogStream(logStream);
return i2p::api::StartI2P(nullptr);
std::shared_ptr<std::ostream> logStream;
//cppLogStream(&out);
return i2p::api::StartI2P(logStream);
}
void C_StopI2P ()

View file

@ -9,16 +9,17 @@
#ifndef CAPI_H__
#define CAPI_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "Identity.h"
#include "Destination.h"
#include "Streaming.h"
#ifdef __cplusplus
extern "C" {
#endif
// initialization start and stop
void C_InitI2P (int argc, char* argv[], const char * appName);
void C_InitI2P (int argc, char argv[], const char * appName);
//void C_InitI2P (int argc, char** argv, const char * appName);
void C_TerminateI2P ();
void C_StartI2P (); //std::ostream *logStream = nullptr);
// write system log to logStream, if not specified to <appName>.log in application's folder