Patrick
05/29/2020, 12:19 PMdlltool.exe -d test.def -l test.lib.a
This gives me a static lib loader (as far as I can understand)
Now I need to compile it using gcc:
gcc main.c -o main -L. -ltest
This works and returns main.exe. However when I execute it I get this error:
---------------------------
main.exe - System Error
---------------------------
The code execution cannot proceed because (null).DLL was not found. Reinstalling the program may fix this problem.
---------------------------
OK
---------------------------
Artyom Degtyarev [JB]
05/29/2020, 12:51 PM-p dynamic
compiler flag?Patrick
05/29/2020, 12:52 PMPatrick
05/29/2020, 12:56 PMPatrick
05/29/2020, 1:04 PMPatrick
05/29/2020, 1:22 PMPatrick
05/29/2020, 1:22 PMPatrick
05/29/2020, 1:23 PMArtyom Degtyarev [JB]
05/29/2020, 1:28 PMPatrick
05/29/2020, 1:29 PMtypedef float __attribute__ ((__vector_size__ (16))) nimmstaWindows_KVector128;
Patrick
05/29/2020, 1:29 PMsvyatoslav.scherbina
05/29/2020, 1:42 PMAlso it would be helpful to understand what a “vectory-typed kotlin function” is so I can identify it in my code and remove it if necessaryExact quote from the issue:
if your C/C++ code uses vector-typed Kotlin functions (which haveÂÂ in their signature in generated C header${prefix}_KVector128
Does this mean I can’t export the code as a dynamic library until the bug is fixed?No, it doesn’t. You can apply the workaround described in the issue.
Patrick
05/29/2020, 1:44 PMPatrick
05/29/2020, 1:44 PMPatrick
05/29/2020, 1:45 PMPatrick
05/29/2020, 1:48 PMNote: after applying this workaround, your program will crash if your C/C++ code uses vector-typed Kotlin functions (which have ${prefix}_KVector128 in their signature in generated C header).
Patrick
05/29/2020, 1:49 PMPatrick
05/29/2020, 1:49 PM#include "nimmstaWindows_api.h"
int main(int argc, char** argv) {
nimmstaWindows_ExportedSymbols *lib = nimmstaWindows_symbols();
}
Patrick
05/29/2020, 1:50 PMlib /def:nimmstaWindows.def /out:nimmstaWindows.lib
and then this command:
cl.exe main.c nimmstaWindows.lib
that's itsvyatoslav.scherbina
05/29/2020, 1:53 PMIs this because of this issue:ÂUnlikely.Note: after applying this workaround, your program will crash if your C/C++ code uses vector-typed Kotlin functions (which have ${prefix}_KVector128 in their signature in generated C header).
This shouldn’t be a problem because I am not using it in my C code, correct?Exactly.
Is there anything else I need to do to get it to work?We have to reproduce the issue on our side first.
Patrick
05/29/2020, 1:54 PMPatrick
05/29/2020, 1:57 PMArtyom Degtyarev [JB]
06/02/2020, 10:35 AMlib.exe
from Visual studio build tools, and used the result .lib file in a simple c file, similar to the one you’ve posted above:
#define __attribute__(x)
#include "kotlinlib_api.h"
int main(int argc, char** argv) {
kotlinlib_ExportedSymbols *lib = kotlinlib_symbols();
}
. For some reason, it works fine.Patrick
06/02/2020, 10:35 AMPatrick
06/02/2020, 10:35 AMPatrick
06/02/2020, 10:40 AMcommonMain {
dependencies {
implementation(kotlin("stdlib-common"))
implementation("com.github.msink:libui:0.1.7")
}}
Patrick
06/02/2020, 10:42 AMPatrick
06/03/2020, 3:53 PMArtyom Degtyarev [JB]
06/03/2020, 4:07 PMPatrick
06/03/2020, 4:11 PM