I’m not at home now but I hust installed the latest version so it should be that one.
Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core™ i5-4670 CPU @ 3.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, haswell)
Does gcc build a 64-bit library by default under mingw?
I don’t know. How can I check it?
FWIW, I don’t know much about interpreting output from nm
.
But my return symbols in 16 Hex (64-bit),
0000000067e813b0 T prob
Your seems to be in 32-bit with 8 Hex
68081290 T _prob
You might have installed 32-bit mingw. You need 64-bit distro.
Can someone link me the right version I should install?
Thank you very much for your help!!
I get mine from here:
http://mingw-w64.org/doku.php/download/mingw-builds
It is an Window online installer, be sure to pick x86_64
over i686
for 64-bit, I don’t know if win32
vs. posix
Threads make a difference, nor dwarf
vs. sjlj
. So you might want to do some reading yourself, if you are particular about these things/
Run
gcc -dumpmachine
For a 64 bit install the output should be x86_64-w64-mingw32
. If it starts with i686-
you will be compiling for 32 bit.
I get mingw32
I did this when I installed the first time…
I’ll try again
Do you know how I can uninstall the old mingw before install the new one?
Ok, I installed the version you suggested me and updated the path, this is the gcc --version result.
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I’ll try to run opendl asap!
Ok, I cannot believe it but opendl now works and gives this as a result:
Ptr{Nothing} @0x0000000067e80000
BUUUUUUT…
when I try to run the ccall line, Julia crashes and I cannot see which is the error because the window closes.
What’s the problem now?
yea… so… I also get seg fault using your code.
signal (11): Segmentation fault
Something about your c-code is not right, it is accessing address it shouldn’t have(?). If you change your dimension a
to be 100 x 2
and b
to be 3 x 100
, you will get something. So I will leave it back to you to debug the c-code.
Multi dimentional arrays are not pointers to pointers etc. in c. You shouldn’t declare you c code like that unless you really have to.
Sorry but I’m not an expert as my code suggests.
What am I supposed to do to include this piece of code in Julia and make it work?
I’m working on a package I want to publish in the next weeks so this ccall() must work also in the package.
I thought that calling C or C++ from Julia was simpler than in the other high level languages but it doesn’t seem like that. For example in R is way more easy.
Please let me know if you can help me and thank you in advance!
The hard part is that **a
(pointer to the pointer) and a matrix in julia are not the same thing. when a[i][j]
is used for a pointer to pointer in c, it first dereference a[i]
(ith memory block after pointer in a) to get the address of the row i and then (*a[i])[j] get dereferenced to get the element in column j, whereas julia Matrix
is contiguous memory mapped values(Note said c representation is not necessarily contiguos row after row. I say row it depends how you interpret dimensions. It can very well be thought as the reverse(as columns)) However, direct definitions with known sizes is a contiguous memory mapped matrix in c like float a[5][], b[6][7];
.