Re: [julia-users] fieldoffsets and the C macro offsetof

2015-09-11 Thread J Luis
Yes, but it requires confirmation that Clang.jl effectively does that and I 
don't have a Clang.jl at hand now (it might have been me, though the Git 
history that I have does not show it)

sexta-feira, 11 de Setembro de 2015 às 22:01:05 UTC+1, Scott Jones escreveu:
>
> That should be reported as a bug in Clang.jl.
> size_t should is unsigned 32 or 64-bit (on today's platforms), and Cint is 
> signed 32-bit, not at all the same!
>
> On Thursday, September 10, 2015 at 11:22:13 PM UTC-4, J Luis wrote:
>>
>> Ok, couldn't resist to one more attempt and I may have found the issue. 
>> If you look at the n_alloc member in  here
>>
>> https://github.com/joa-quim/GMT.jl/blob/master/src/libgmt_h.jl#L1445
>>
>> and here
>>
>>
>> http://gmt.soest.hawaii.edu/projects/gmt/repository/entry/branches/5.2.0/src/gmt_resources.h#L543
>>
>> you'll notice that it is size_t in C an Cint in Julia (converted with 
>> Clang). If I change the Julia type to Csize_t than the offsets are the same.
>>
>> Now I'm really going to sleep.
>>
>> sexta-feira, 11 de Setembro de 2015 às 04:07:53 UTC+1, J Luis escreveu:
>>>
>>> No, that's not the case. Pure C built with VS2013
>>>
>>> Ok, tomorrow I'll try to post links to code showing this case.
>>>
>>> sexta-feira, 11 de Setembro de 2015 às 04:03:48 UTC+1, Jameson escreveu:

 generally no, unless you are using C++11 features or ms-bitfields

 On Thu, Sep 10, 2015 at 11:01 PM J Luis  wrote:

> Thanks, it's very late here and posting the case will take time. But 
> one thing before I go.
> The fact that I'm using a Julia compiled with mingw64 and accessing a 
> dll built with VS could explain this, no?
>
>
>
> sexta-feira, 11 de Setembro de 2015 às 03:47:12 UTC+1, Jameson 
> escreveu:
>
>> Yes (unless C doesn't have an equivalent representation), can you 
>> post the case?
>>
>> On Thu, Sep 10, 2015 at 10:43 PM J Luis  wrote:
>>
>>> Hi,
>>>
>>> When we have a immutable that mimics a C struct, are the results of 
>>> fieldoffsets() from the Julia side and offsetoff() at the C side 
>>> supposed 
>>> to give the same result?
>>> (Well, I already found one case were they don't)
>>>
>>

Re: [julia-users] fieldoffsets and the C macro offsetof

2015-09-11 Thread Scott Jones
That should be reported as a bug in Clang.jl.
size_t should is unsigned 32 or 64-bit (on today's platforms), and Cint is 
signed 32-bit, not at all the same!

On Thursday, September 10, 2015 at 11:22:13 PM UTC-4, J Luis wrote:
>
> Ok, couldn't resist to one more attempt and I may have found the issue. If 
> you look at the n_alloc member in  here
>
> https://github.com/joa-quim/GMT.jl/blob/master/src/libgmt_h.jl#L1445
>
> and here
>
>
> http://gmt.soest.hawaii.edu/projects/gmt/repository/entry/branches/5.2.0/src/gmt_resources.h#L543
>
> you'll notice that it is size_t in C an Cint in Julia (converted with 
> Clang). If I change the Julia type to Csize_t than the offsets are the same.
>
> Now I'm really going to sleep.
>
> sexta-feira, 11 de Setembro de 2015 às 04:07:53 UTC+1, J Luis escreveu:
>>
>> No, that's not the case. Pure C built with VS2013
>>
>> Ok, tomorrow I'll try to post links to code showing this case.
>>
>> sexta-feira, 11 de Setembro de 2015 às 04:03:48 UTC+1, Jameson escreveu:
>>>
>>> generally no, unless you are using C++11 features or ms-bitfields
>>>
>>> On Thu, Sep 10, 2015 at 11:01 PM J Luis  wrote:
>>>
 Thanks, it's very late here and posting the case will take time. But 
 one thing before I go.
 The fact that I'm using a Julia compiled with mingw64 and accessing a 
 dll built with VS could explain this, no?



 sexta-feira, 11 de Setembro de 2015 às 03:47:12 UTC+1, Jameson escreveu:

> Yes (unless C doesn't have an equivalent representation), can you post 
> the case?
>
> On Thu, Sep 10, 2015 at 10:43 PM J Luis  wrote:
>
>> Hi,
>>
>> When we have a immutable that mimics a C struct, are the results of 
>> fieldoffsets() from the Julia side and offsetoff() at the C side 
>> supposed 
>> to give the same result?
>> (Well, I already found one case were they don't)
>>
>

Re: [julia-users] fieldoffsets and the C macro offsetof

2015-09-10 Thread J Luis
Ok, couldn't resist to one more attempt and I may have found the issue. If 
you look at the n_alloc member in  here

https://github.com/joa-quim/GMT.jl/blob/master/src/libgmt_h.jl#L1445

and here

http://gmt.soest.hawaii.edu/projects/gmt/repository/entry/branches/5.2.0/src/gmt_resources.h#L543

you'll notice that it is size_t in C an Cint in Julia (converted with 
Clang). If I change the Julia type to Csize_t than the offsets are the same.

Now I'm really going to sleep.

sexta-feira, 11 de Setembro de 2015 às 04:07:53 UTC+1, J Luis escreveu:
>
> No, that's not the case. Pure C built with VS2013
>
> Ok, tomorrow I'll try to post links to code showing this case.
>
> sexta-feira, 11 de Setembro de 2015 às 04:03:48 UTC+1, Jameson escreveu:
>>
>> generally no, unless you are using C++11 features or ms-bitfields
>>
>> On Thu, Sep 10, 2015 at 11:01 PM J Luis  wrote:
>>
>>> Thanks, it's very late here and posting the case will take time. But one 
>>> thing before I go.
>>> The fact that I'm using a Julia compiled with mingw64 and accessing a 
>>> dll built with VS could explain this, no?
>>>
>>>
>>>
>>> sexta-feira, 11 de Setembro de 2015 às 03:47:12 UTC+1, Jameson escreveu:
>>>
 Yes (unless C doesn't have an equivalent representation), can you post 
 the case?

 On Thu, Sep 10, 2015 at 10:43 PM J Luis  wrote:

> Hi,
>
> When we have a immutable that mimics a C struct, are the results of 
> fieldoffsets() from the Julia side and offsetoff() at the C side supposed 
> to give the same result?
> (Well, I already found one case were they don't)
>


Re: [julia-users] fieldoffsets and the C macro offsetof

2015-09-10 Thread J Luis
No, that's not the case. Pure C built with VS2013

Ok, tomorrow I'll try to post links to code showing this case.

sexta-feira, 11 de Setembro de 2015 às 04:03:48 UTC+1, Jameson escreveu:
>
> generally no, unless you are using C++11 features or ms-bitfields
>
> On Thu, Sep 10, 2015 at 11:01 PM J Luis > 
> wrote:
>
>> Thanks, it's very late here and posting the case will take time. But one 
>> thing before I go.
>> The fact that I'm using a Julia compiled with mingw64 and accessing a dll 
>> built with VS could explain this, no?
>>
>>
>>
>> sexta-feira, 11 de Setembro de 2015 às 03:47:12 UTC+1, Jameson escreveu:
>>
>>> Yes (unless C doesn't have an equivalent representation), can you post 
>>> the case?
>>>
>>> On Thu, Sep 10, 2015 at 10:43 PM J Luis  wrote:
>>>
 Hi,

 When we have a immutable that mimics a C struct, are the results of 
 fieldoffsets() from the Julia side and offsetoff() at the C side supposed 
 to give the same result?
 (Well, I already found one case were they don't)

>>>

Re: [julia-users] fieldoffsets and the C macro offsetof

2015-09-10 Thread Jameson Nash
generally no, unless you are using C++11 features or ms-bitfields

On Thu, Sep 10, 2015 at 11:01 PM J Luis  wrote:

> Thanks, it's very late here and posting the case will take time. But one
> thing before I go.
> The fact that I'm using a Julia compiled with mingw64 and accessing a dll
> built with VS could explain this, no?
>
>
>
> sexta-feira, 11 de Setembro de 2015 às 03:47:12 UTC+1, Jameson escreveu:
>
>> Yes (unless C doesn't have an equivalent representation), can you post
>> the case?
>>
>> On Thu, Sep 10, 2015 at 10:43 PM J Luis  wrote:
>>
>>> Hi,
>>>
>>> When we have a immutable that mimics a C struct, are the results of
>>> fieldoffsets() from the Julia side and offsetoff() at the C side supposed
>>> to give the same result?
>>> (Well, I already found one case were they don't)
>>>
>>


Re: [julia-users] fieldoffsets and the C macro offsetof

2015-09-10 Thread J Luis
Thanks, it's very late here and posting the case will take time. But one 
thing before I go.
The fact that I'm using a Julia compiled with mingw64 and accessing a dll 
built with VS could explain this, no?


sexta-feira, 11 de Setembro de 2015 às 03:47:12 UTC+1, Jameson escreveu:
>
> Yes (unless C doesn't have an equivalent representation), can you post the 
> case?
>
> On Thu, Sep 10, 2015 at 10:43 PM J Luis > 
> wrote:
>
>> Hi,
>>
>> When we have a immutable that mimics a C struct, are the results of 
>> fieldoffsets() from the Julia side and offsetoff() at the C side supposed 
>> to give the same result?
>> (Well, I already found one case were they don't)
>>
>

Re: [julia-users] fieldoffsets and the C macro offsetof

2015-09-10 Thread Jameson Nash
Yes (unless C doesn't have an equivalent representation), can you post the
case?

On Thu, Sep 10, 2015 at 10:43 PM J Luis  wrote:

> Hi,
>
> When we have a immutable that mimics a C struct, are the results of
> fieldoffsets() from the Julia side and offsetoff() at the C side supposed
> to give the same result?
> (Well, I already found one case were they don't)
>


[julia-users] fieldoffsets and the C macro offsetof

2015-09-10 Thread J Luis
Hi,

When we have a immutable that mimics a C struct, are the results of 
fieldoffsets() from the Julia side and offsetoff() at the C side supposed 
to give the same result?
(Well, I already found one case were they don't)