Comments (5)
I've thought about this multiple times.
There are different things to consider. Most importantly: What is the goal, which you've stated.
To achieve this with a minimal impact and maximum stability (rewriting libcob [and possibly even cobc] would be a very long big task) I'd suggest integrating a JNI "interface" consisting of:
- java classes to provide the same set of functions that the C interface has
- java classes that will start the runtime if needed, and possibly providing an API to adjust the runtime settings
- java classes to wrap the conversions needed (especially concerning
String
objects but also the wrapper types likeInteger
) - adjustments in libcob to provide a JNI "call-in" method and set a flag if started from java - if this was the case then all runtime exceptions in libcob must be returned as a java exception (so add an exception class in java, too)
This will allow anyone to call COBOL modules from JAVA, using primitive types and their Wrapper Objects.
A relative small change to cobc will allow to create a "java wrapper" source file that provides access to a COBOL program and methods for each external entry point. To do so it will use the java classes from step 1.
When this is finished it would theoretically be possible to change the code generation of cobc to directly create java source files (and also optionally to use cobc to compile them) but this would only be reasonable if the runtime is converted to Java, too. Despite the work it will definitely slow down the runtime by numbers.
In any case I invite you to work on this within the GnuCOBOL project using current "trunk" as start (on a new branch).
This way it is easier for others that know the system to get involved when wanted, it likely has a bigger test audience and there are a lot of things that will ease different parts (like the parameter conversion and setting of runtime options).
What do you think about this?
from opensource-cobol.
Thanks for your feedback.
I think also good implements JNI Interface.
I forgot to say, in Japan, Everyone want Java code strongly!
So we plan to add cobc's Java options (like --java
) and develop JAVA libcob.
In my think, we edit only typeck and codegen in compiler.
And create new library JAVA libcob, but similar C libcob.
we are considering follows for Java and COBOL cooperation.
-
We create JAVA INTERFACE CLASS.
Java class which INTERFACE is implemented is called by CALL function from java created from COBOL. -
We prepared functions, write Java code into COBOL source code.
-
All arguments between Java and COBOL are only String or Integer(double).
In any case I invite you to work on this within the GnuCOBOL project using current "trunk" as start (on a new branch).
It is attractive proposal for me.
But also GPLv3 issues are under discussion, so please wait a moment.
from opensource-cobol.
Hello,
I made it.
https://github.com/opensourcecobol/opensourcecobol4j
from opensource-cobol.
That's an interesting new repo. It looks like it uses a different approach than the old one outlined above.
Can you share more about the approach actually used now and also about the process you did to go from opensourcecobol to opensourcecobol4j?
Note: I assume the README is not up to date, it specifies a not existing directory "cobj" and not include the "libcob" directory.
from opensource-cobol.
My first thought was to include Java functionality as a feature of opensource COBOL.
However, since the implementation became complicated, I chose to create a new repository as a separate repository, giving priority to developability.
About approach:
We aimed to make Java without changing the functions and logic of opensource COBOL.
Regarding how to hold data, we have created a class that operates byte type and made it accessible so that Java can handle it in much the same way as the C version.
The compiler also outputs Java code in a 1:1 relationship with the C version.
(Although there is a difference in the order of code output)
P.S.
I will update the README together later.
from opensource-cobol.
Related Issues (16)
- test
- 機能開発時のブランチ名について HOT 1
- プレリリース用のブランチ作成について HOT 5
- コーディングスタイルについて
- releases are missing from English osscons site HOT 1
- English commit-messages / missing Changelog entries
- main repo site points to http://www.osscons.jp/osscobol/download/ - access forbidden http 403 HOT 3
- JSON support HOT 7
- Update automake files
- make error while trying to generate/install opensource COBOL on Linux HOT 4
- Memory leaks in `Hello World` program HOT 1
- Add CI for NIST COBOL85 test HOT 1
- Solve warning messages
- #INCLUDE problem in libcob/call.c HOT 1
- Duplicate definitions of the same variable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opensource-cobol.