digitalmars.D.learn - Using Clang with D
- Jacob Carlborg (25/25) Jan 26 2012 I'm trying to port a simple example that uses Clang from C to D but for
- Jacob Carlborg (5/28) Jan 26 2012 I've now found out that I only get this error when compiling as 64bit.
- Timon Gehr (3/36) Jan 26 2012 It is possibly an error in the bindings. What are the C and D
- Jacob Carlborg (7/45) Jan 26 2012 This is the declarations I'm using for this example:
I'm trying to port a simple example that uses Clang from C to D but for some reason the D version results in a segmentation fault. This is the C code: http://pastebin.com/4B2JGz9n This is the D code: http://pastebin.com/XPBsSVup The stacktrace from GDB looks like this: (gdb) r Starting program: /Users/jacob/development/d/dstep/bin/dstep NSObject.h Reading symbols for shared libraries .+.. done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000004 0x0000000100104139 in clang_formatDiagnostic () (gdb) bt I'm using DMD 2.057 on Mac OS X compiling as 64bit. Any idea what I have done wrong? -- /Jacob Carlborg
Jan 26 2012
On 2012-01-26 10:29, Jacob Carlborg wrote:I'm trying to port a simple example that uses Clang from C to D but for some reason the D version results in a segmentation fault. This is the C code: http://pastebin.com/4B2JGz9n This is the D code: http://pastebin.com/XPBsSVup The stacktrace from GDB looks like this: (gdb) r Starting program: /Users/jacob/development/d/dstep/bin/dstep NSObject.h Reading symbols for shared libraries .+.. done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000004 0x0000000100104139 in clang_formatDiagnostic () (gdb) bt I'm using DMD 2.057 on Mac OS X compiling as 64bit. Any idea what I have done wrong?I've now found out that I only get this error when compiling as 64bit. When I compile as 32bit everything works fine. -- /Jacob Carlborg
Jan 26 2012
On 01/26/2012 08:44 PM, Jacob Carlborg wrote:On 2012-01-26 10:29, Jacob Carlborg wrote:It is possibly an error in the bindings. What are the C and D declarations of the methods you are using?I'm trying to port a simple example that uses Clang from C to D but for some reason the D version results in a segmentation fault. This is the C code: http://pastebin.com/4B2JGz9n This is the D code: http://pastebin.com/XPBsSVup The stacktrace from GDB looks like this: (gdb) r Starting program: /Users/jacob/development/d/dstep/bin/dstep NSObject.h Reading symbols for shared libraries .+.. done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000004 0x0000000100104139 in clang_formatDiagnostic () (gdb) bt I'm using DMD 2.057 on Mac OS X compiling as 64bit. Any idea what I have done wrong?I've now found out that I only get this error when compiling as 64bit. When I compile as 32bit everything works fine.
Jan 26 2012
On 2012-01-26 20:49, Timon Gehr wrote:On 01/26/2012 08:44 PM, Jacob Carlborg wrote:This is the declarations I'm using for this example: http://pastebin.com/fDZ1EftJ This is the complete file with the bindings: https://github.com/jacob-carlborg/dstep/blob/master/clang/c/index.d -- /Jacob CarlborgOn 2012-01-26 10:29, Jacob Carlborg wrote:It is possibly an error in the bindings. What are the C and D declarations of the methods you are using?I'm trying to port a simple example that uses Clang from C to D but for some reason the D version results in a segmentation fault. This is the C code: http://pastebin.com/4B2JGz9n This is the D code: http://pastebin.com/XPBsSVup The stacktrace from GDB looks like this: (gdb) r Starting program: /Users/jacob/development/d/dstep/bin/dstep NSObject.h Reading symbols for shared libraries .+.. done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000004 0x0000000100104139 in clang_formatDiagnostic () (gdb) bt I'm using DMD 2.057 on Mac OS X compiling as 64bit. Any idea what I have done wrong?I've now found out that I only get this error when compiling as 64bit. When I compile as 32bit everything works fine.
Jan 26 2012