Skip to content

Commit 394c40e

Browse files
authored
Merge branch 'master' into fix
2 parents 1e9c83c + 6fcb5cd commit 394c40e

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
The *gorfc* package provides bindings for *SAP NW RFC Library*, for a comfortable way of calling remote enabled ABAP function modules (RFMs) from [Go](https://golang.org).
88

9-
The current release is fully functional on Linux and experimental on Windows, see the [Issue #1](https://github.com/SAP/gorfc/issues/1).
9+
The current release is fully functional on Linux and experimental on Windows and macOS see the [Issue #1](https://github.com/SAP/gorfc/issues/1).
1010

1111
## Table of contents
1212

@@ -21,7 +21,7 @@ The current release is fully functional on Linux and experimental on Windows, se
2121

2222
## Platforms and Prerequisites
2323

24-
The SAP NW RFC Library is a prerequisite for using the Go RFC connector and must be installed on the same system. It is available on many platforms supported by Go, except macOS, Plan 9 and BSD.
24+
The SAP NW RFC Library is a prerequisite for using the Go RFC connector and must be installed on the same system. It is available on many platforms supported by Go, except Plan 9 and BSD.
2525

2626
A prerequisite to download *SAP NW RFC Library* is having a **customer or partner account** on *SAP Service Marketplace* . If you are SAP employee please check SAP OSS note [1037575 - Software download authorizations for SAP employees](http://service.sap.com/sap/support/notes/1037575).
2727

@@ -75,6 +75,8 @@ To install _gorfc_ and dependencies, run following commands:
7575
```bash
7676
export CGO_CFLAGS="-I $SAPNWRFC_HOME/include"
7777
export CGO_LDFLAGS="-L $SAPNWRFC_HOME/lib"
78+
export CGO_CFLAGS_ALLOW=.*
79+
export CGO_LDFLAGS_ALLOW=.*
7880
go get github.com/stretchr/testify
7981
go get github.com/sap/gorfc
8082
cd $GOPATH/src/github.com/sap/gorfc/gorfc

gorfc/gorfc.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ package gorfc
2727
#cgo windows LDFLAGS: -L/usr/local/sap/nwrfcsdk/libwin -lsapnwrfc -llibsapucum
2828
#cgo windows LDFLAGS: -O2 -g
2929
30+
#cgo darwin LDFLAGS: -lsapnwrfc -lsapucum
31+
#cgo darwin LDFLAGS: -O2 -minline-all-stringops -g -fno-strict-aliasing -fno-omit-frame-pointer
32+
#cgo darwin LDFLAGS: -m64 -fexceptions -funsigned-char -Wall -Wno-uninitialized -Wno-long-long
33+
#cgo darwin LDFLAGS: -Wcast-align -pthread
34+
35+
#cgo darwin CFLAGS: -DNDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DSAPonUNIX
36+
#cgo darwin CFLAGS: -DSAPwithUNICODE -D__NO_MATH_INLINES -DSAPwithTHREADS -DSAPonDARW
37+
#cgo darwin CFLAGS: -O2 -minline-all-stringops -g -fno-strict-aliasing -fno-omit-frame-pointer
38+
#cgo darwin CFLAGS: -m64 -fexceptions -Wall -Wno-uninitialized -Wno-long-long
39+
#cgo darwin CFLAGS: -Wcast-align -pthread -pipe -Wno-unused-variable
40+
3041
#include <sapnwrfc.h>
3142
3243
static SAP_UC* GoMallocU(unsigned size) {
@@ -289,11 +300,14 @@ func nWrapString(uc *C.SAP_UC, ucLen C.int, strip bool) (string, error) {
289300
defer C.free(unsafe.Pointer(utf8Str))
290301

291302
resultLen := C.uint(0)
303+
292304
var errorInfo C.RFC_ERROR_INFO
293-
rc := C.RfcSAPUCToUTF8(uc, C.uint(ucLen), utf8Str, &utf8Len, &resultLen, &errorInfo)
305+
rc = C.RfcSAPUCToUTF8(uc, (C.uint)(length), (*C.RFC_BYTE)(unsafe.Pointer(utf8str)), &utf8Size, &resultLen, &errorInfo)
306+
294307
if rc != C.RFC_OK {
295308
return "", rfcError(errorInfo, "failed to wrap C string: %s", errorInfo.message)
296309
}
310+
297311
result := C.GoString((*C.char)(unsafe.Pointer(utf8Str)))
298312

299313
if strip {

gorfc/gorfc_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ func isValueInList(value string, list []string) bool {
2828
//
2929
func TestNWRFCLibVersion(t *testing.T) {
3030
major, minor, patchlevel := GetNWRFCLibVersion()
31-
assert.Equal(t, uint(7500), major) // adapt to your NW RFC Lib version
32-
assert.Equal(t, uint(0), minor)
33-
assert.Equal(t, uint(2), patchlevel)
31+
assert.Equal(t, "7500.0.5", fmt.Sprintf("%d.%d.%d", major, minor, patchlevel)) // adapt to your NW RFC Lib version
3432
}
3533

3634
//

0 commit comments

Comments
 (0)