Questions tagged [cross-language]

In programming, "cross-language" or "multi-language" refers to features that operate across multiple programming languages.

In programming, "cross-language" or "multi-language" refers to features that operate across multiple programming languages.

Cross-language features include type systems, data formats, storage layouts, etc. which are common across multiple languages. They help applications or services written in different languages to inter-operate and exchange information.

132 questions
7
votes
2 answers

Is it safe to "play" with parameter constness in extern "C" declarations?

Suppose I'm using some C library which has a function: int foo(char* str); and I know for a fact that foo() does not modify the memory pointed to by str. It's just poorly written and doesn't bother to declare str being constant. Now, in my C++…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
7
votes
3 answers

Unifying enums across multiple languages

I have one large project with components in multiple languages that each depend on some of the same enum values. What solutions have you come up with to unify enums across multiple arbitrary languages? I can think of a few, but I'm looking for the…
Jonathan Swinney
  • 1,054
  • 9
  • 29
7
votes
3 answers

Invoking C++ code from Java (GCJ)

I'm trying to invoke C++ from Java using GCJ using the CNI, so far I'm able to invoke Java code from C++. How can I invoke C++ from Java using the CNI?
Joe D
  • 2,855
  • 2
  • 31
  • 25
6
votes
2 answers

is there a generic query language for arbitrary sets independent from a programming language?

I'm looking for a way to define queries on sets independently from a programming language or the kind of sets. In detail this would be a language definition and implementations for common languages like Java, C++, Python etc. As commented I'm not…
frans
  • 8,868
  • 11
  • 58
  • 132
5
votes
3 answers

extern "C" - before or after library header includes?

I'm writing a C library, which may potentially be useful to people writing C++. It has a header which looks like this: #ifndef FOO_H_ #define FOO_H_ #include #include #include #ifdef __cplusplus extern "C"…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
5
votes
1 answer

Use C library in a C++ code with non-compatible code

I want to use a C library in a C++ code, without modifying it. The library contains fragment of code non-compatible with c++ like : C++ keyword new and delete _Atomic object bad declaration I compiled the C library into a .so. And I also used it…
Pierre I
  • 61
  • 5
5
votes
1 answer

Generating a SHA256 hash in python and javascript leads to different results

I have a problem with encrypting plaintext. What i am doing in Python: def encrypt(plaintext): import hashlib, base64 hashed = hashlib.sha256(plaintext).digest() return base64.b64encode(hashed) def main(): input_value = "a" …
mr_5p4rk_
  • 53
  • 1
  • 6
5
votes
4 answers

How I can access my C++ function in my C code or vice versa?

I want to implement a project in C, but it is comfortable to code some part of project in C++ and then call them from main C code. Is it possible?! if yes, how I can do it?! thanks in advance :) P.S. I used some libraries in my C++ Code such as…
Soheil
  • 473
  • 9
  • 23
5
votes
2 answers

Encrypt in PHP, Decrypt in Python

PHP code: $key = "12345678abcdefgh12345678abcdefgh"; $iv = "12345678abcdefgh"; $plaindata = "This is a test string."; $enc = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaindata, MCRYPT_MODE_CBC,…
user812120
  • 585
  • 1
  • 10
  • 21
4
votes
1 answer

How to call a Java programme from .Net?

I have a little java programme, that responsible for sending message via mobile phone, and which is a native programme on the PC. But we won't convert it to .net, but it can be execute via dos cmd like: java jar my_send_message.jar -p 12345678 -m…
DNB5brims
  • 29,344
  • 50
  • 131
  • 195
4
votes
1 answer

Strategies for sharing common business logic across different programming languages

Having a monolithic business application with complex business logic implemented in Visual Dataflex, we are facing the challenge of maintaining our business logic across programming languages as certain features are written in other programming…
Ola Eldøy
  • 5,720
  • 7
  • 49
  • 82
4
votes
0 answers

Haskell executable linking with static library written in C++ got `undefined reference`

I've create a static library: // foo.h extern "C" { int foo (const char* arg0, int arg1); } // foo.cpp #include "foo.h" // implementation of foo This block of code was compiled to foo.o and packaged into libfoo.a which was installed to MinGW's lib…
claude
  • 237
  • 1
  • 8
4
votes
1 answer

Cannot use java value as parameter to java annotation on scala function

I have 3 java files: HW.java, myAnn.java, and Constants.java in package myApp. Constants.java: public final class Constants { public static final String WORLD ="World"; } myAnn.java: public @interface myAnn { java.lang.String name() default…
scalapeno
  • 833
  • 1
  • 6
  • 13
4
votes
1 answer

Can GRPC services on the server be implemented using different languages?

As I know, GRPC clients can be generated for any language that support GRPC. However, can the services on the server be implemented using different languages for the same proto file? For example, I have this proto file: service Greeter { rpc…
Nolan Edric
  • 406
  • 4
  • 13
4
votes
3 answers

Why do dynamic arrays in C++ and Java have different initial capacities?

So I've been searching for how actually dynamic array works in general. what i found is two different concepts. In C++ In C++, dynamic array is generally implemented by vectors. Vectors set the capacity to 0, increases the count to insert new…
secretgenes
  • 1,291
  • 1
  • 19
  • 39
1
2
3
8 9