fix nlopt_srand for 32bit machines#9
fix nlopt_srand for 32bit machines#9dataPulverizer merged 2 commits intoDlangScience:masterfrom jmh530:featureA
Conversation
|
you should use |
|
If I'm reading this correctly, it looks like c_ulong gives uint on Windows always and then switches on Posix depending on the architecture. |
|
Correct, but the point of
|
|
Ok. That's great and I will change when I have a chance. It does look like On Fri, Mar 11, 2016 at 10:04 AM, John Colvin notifications@github.com
|
|
Presumably if someone is using c_ulong then they're interfacing to C, in
|
|
My point is that all the D documentation on interfacing with C says that the behavior changes between 32bit and 64bit. It does not say that this behavior does not apply in Windows.
|
|
Fair point. If you have a clearer way to express the situation in the dlang My point is that all the D documentation on interfacing with C says that
— |
|
Should the version flags not be added to the build script or does dub somehow do this automatically? |
|
Dub can detect what OS you're on, but if you want 32bit or 64bit, then you have to submit --arch at the command line. There probably is scope to adjust the libs line in the dub.json to be libs-posix. When I use this on Windows, I have to adjust that. |
|
dmd sets whatever builtin flags are relevant for the chosen target. |
|
That's good, I'll merge now then |
fix nlopt_srand for 32bit machines
|
@jmh530 Note for the future: instead of having one commit that does something the wrong way and then another immediately following it to fix it, you can make your changes and then You will have to do |
The input type on nlopt_srand needs to account for the difference in 32bit/64bit
machines.
The original C signature of nlopt_srand is
NLOPT_EXTERN(void) nlopt_srand(unsigned long seed);
According to http://wiki.dlang.org/D_binding_for_C
unsigned long only is converted to ulong only on 64bit, but on 32bit it needs
to be uint.
I'm not completely confident I'm using the correct version() blocks.