-
-
Save Axmill/394a4f577b0ee98465a5 to your computer and use it in GitHub Desktop.
The C++ File & Python File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* If you are wondering why there is C++ code in a C lib, it is because | |
* C does not offer good string support, so C++ code is needed to mani- | |
* pulate strings without implementing a whole bunch of code. | |
*/ | |
#include <string> | |
#include <iostream> | |
using namespace std; | |
extern "C" | |
{ | |
#include "stringManipulation.hpp" | |
#include <stdlib.h> | |
string string1; | |
string string2; | |
string concatenatedString; | |
//add more strings if needed | |
//creating refs | |
string& str1 = string1; | |
string& str2 = string2; | |
string& conStr = concatenatedString; | |
string concatString(string& str1, string& str2) | |
{ | |
conStr = str1 + str2; | |
return conStr; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
interfaceLib = ctypes.CDLL('Shared_Lib/bin/Library/libShared_Lib.so') | |
interfaceLib.test() | |
str1 = "H" | |
str2 = "I" | |
text = interfaceLib.concatString(str1, str2) | |
print(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment