소스 파일이 여러 가지 프로그래밍 언어로 작성된 경우 소스 파일간에 기능을 공유하는 방법을 알아 내려고합니다. 아래에 표시된 것처럼 세 가지 다른 소스 파일에서 세 가지 언어로 작성된 함수를 공유 할 수있는 방법이 있습니까? 각 언어로 작성된 함수를 다른 언어에서 액세스 할 수 있기를 바랍니다.여러 프로그래밍 언어로 소스 파일 간의 기능 공유
(모든 소스 파일이 같은 폴더에, 명확합니다.)
자바 파일 :
public class JavaFile{
public static String generateStringFromRegex(String theRegex){
//native Java function, implement this using xeger
}
public static String generateRandomString(String theString){
//return the result from the corresponding Javascript function
}
public static int getFileText(String filename){
//return the result from the corresponding C++ function
}
}
자바 스크립트 파일 :
function getFileText(fileName){
//call the corresponding C++ function and return the value
}
function generateRandomString(theString){
//native Javascript function
}
function generateStringFromRegex(int1, int2){
//call the corresponding Java function and return the value
}
C++ 파일 :
#include<string>
int main(){
}
string generateRandomString(string theString){
//call the corresponding Javascript function and return the value
}
string generateStringFromRegex(string theRegex){
//call the corresponding Java function and return its value
}
string getFileText(string fileName){
//native C++ function: get the text of a text file
}
아파치 희생? Protobuf? 웹 서비스? –
@AbhinavSarkar 나는이 중 어떤 것이이 목적에 가장 적합한 지 모릅니다 : 그래서 나는이 질문을했습니다. –
필요에 따라 평가하고 가장 적합한 것을 선택하십시오. –