Problem with concating of multiple wide string in wcout - unnecessary space after each charcater

Ladislav Török ltorokrl at gmail.com
Tue Dec 14 11:47:10 UTC 2021


Here is copy of my conversation with Maurizio Cimadamore:
1. email by me:
Hi,

use the example panama-tutorial-005 on
https://github.com/tornaia/panama-tutorial.
I am checked and result in my console on Windows (CMD) is:
---
D:\repositories\moje\GitHub\tornaia\panama-tutorial\panama-tutorial-005>java
--enable-preview --add-modules jdk.incubator.foreign
--enable-native-access=ALL-UNNAMED
-Djava.library.path=lib/helloworldwinrt/target -classpath
target/classes;lib/target/jar/*
com.github.tornaia.panama.tutorial005.Tutorial005
WARNING: Using incubator modules: jdk.incubator.foreign
Start
N u m b e r   o f   d e v i c e s :   2 5 9 5
 End

D:\repositories\moje\GitHub\tornaia\panama-tutorial\panama-tutorial-005>
---
See space after each character of started in place where is used concating
of multiple wide string in wcout.
!!! Build the sample is in Microsoft Visual Studio 2019, configuration is
Release x64 !!! For configuration Debug x64 is all ok.
Output is:
---
D:\repositories\moje\GitHub\tornaia\panama-tutorial\panama-tutorial-005>java
--enable-preview --add-modules jdk.incubator.foreign
--enable-native-access=ALL-UNNAMED
-Djava.library.path=lib/helloworldwinrt/target -classpath
target/classes;lib/target/jar/*
com.github.tornaia.panama.tutorial005.Tutorial005
WARNING: Using incubator modules: jdk.incubator.foreign
Start
Number of devices: 2595
End

D:\repositories\moje\GitHub\tornaia\panama-tutorial\panama-tutorial-005>
---

Thanks.

2. email by Maurizio Cimadamore (his answer on my 1. email by me):

Adding Jorn, who might know more.

One control question first: have you tried calling your C++ code directly
(e.g. w/o Panama, using a `main`) ? I have a feeling that you might get the
same behavior there. I note that your CPP library is not really returning a
string back to Java, but it's doing a `cout` to print things on the
terminal console. It's unlikely that Panama will have any effect here.

(in general, please use mailing list :-)).

Thanks
Maurizio

*** Here is my reaction on previous 2. email by Maurizio Cimadamore ***
I was try of calling my C++ code directly (without Panama, using a 'main')
in other application - building of this application in Microsoft Visual
Studio 2019, configuration1 Release x64 and configuration2 Debug x64 and is
all ok (in both cases):
--- Debug ---
Microsoft Windows [Version 10.0.19043.1348]
(c) Microsoft Corporation. All rights reserved.

D:\MSVS2019\Projects\Project2\x64\Debug>Project2.exe
Number of devices: 2595
Result: 0

D:\MSVS2019\Projects\Project2\x64\Debug>
--- Debug ---

--- Release ---
Microsoft Windows [Version 10.0.19043.1348]
(c) Microsoft Corporation. All rights reserved.

D:\MSVS2019\Projects\Project2\x64\Release>Project2.exe
Number of devices: 2595
Result: 0

D:\MSVS2019\Projects\Project2\x64\Release>
--- Release ---

Code of my client application:
#include "helloworldwinrt.h"
#include <stdio.h>

int main()
{
     int result = print_number_of_devices();
     printf("Result: %d\n", result);
}

"I note that your CPP library is not really returning a string back to
Java, but it's doing a `cout` to print things on the terminal console." ---
Yes.

" It's unlikely that Panama will have any effect here." --- It doesn't look
like that yet. Could someone practically try it?

Thanks
Ladislav


More information about the panama-dev mailing list