Re: how to declare C's static function?
On Monday, 28 March 2016 at 04:33:06 UTC, Rikki Cattermole wrote: You have two choices. Change the name in code (so manual mangling) or use pragma(mangle, ...) to change it instead. So... You mean there are no way to declare functions without exporting the symbol? There are so many instances to change.. But thanks any way. Aki.
Re: how to declare C's static function?
On Monday, 28 March 2016 at 04:27:27 UTC, aki wrote: On Monday, 28 March 2016 at 04:12:56 UTC, Rikki Cattermole wrote: Do you need it to use extern(C)? Because if you don't, just drop that. D's mangling will fix it. Yes, I do need extern(C) for some reason like: alias Hook = extern(C) void function(); void sethook(Hook func) { ... } ... sethook() ... Some function expects such a function as an argument. Aki. Okay so you're needing extern(C). I was assuming they were just internal functions. You have two choices. Change the name in code (so manual mangling) or use pragma(mangle, ...) to change it instead.
Re: how to declare C's static function?
On Monday, 28 March 2016 at 04:12:56 UTC, Rikki Cattermole wrote: Do you need it to use extern(C)? Because if you don't, just drop that. D's mangling will fix it. Yes, I do need extern(C) for some reason like: alias Hook = extern(C) void function(); void sethook(Hook func) { ... } ... sethook() ... Some function expects such a function as an argument. Aki.
Re: how to declare C's static function?
Do you need it to use extern(C)? Because if you don't, just drop that. D's mangling will fix it.
how to declare C's static function?
Hello, When I porting legacy app. written in C to D, I have a problem. file a.d: extern (C) private void foo() {} file b.d: extern (C) private void foo() {} Error 1: Previous Definition Different : _foo In C language, "static void foo(){}" does not export the symbol out side the compilation unit. In D, the function foo() above conflicts even if it is private. How can I declare C's static function? Regards, Aki.
Re: Vibelog: dyaml compilation problems
On Sunday, 27 March 2016 at 09:57:40 UTC, Nicholas Wilson wrote: So I'm trying to run vibelog and have cloned the repo used $dub run. One dependency is dyaml. This doesn't compile, but looks like the latest commit to master fixes this. where in the dependency chain is this? Or in other words: What do I have to change to make $ dub upgrade fix my problem? Fixed. Vibelog depends on stringex. Stringex depends on dyaml. change stringex's dub.json to depend on dyamls git head.
Re: Strange behavior in console with UTF-8
On Saturday, 26 March 2016 at 16:34:34 UTC, Steven Schveighoffer wrote: On 3/25/16 6:47 PM, Jonathan Villa wrote: At this point, I think knowing exactly what input you are sending would be helpful. Can you attach a file which has the input that causes the error? Or just paste the input into your post. -Steve I've tested on Debian 4.2 x64 using CHAR type, and it behaves correctly without any problems. Clearly this bug must be something related with the Windows console. Here's the behaviour in Windows 10 x64: http://prntscr.com/akskt1 And here's in Debian x64 4.2: http://prntscr.com/akskjw JV
Re: Strange behavior in console with UTF-8
On Saturday, 26 March 2016 at 16:34:34 UTC, Steven Schveighoffer wrote: On 3/25/16 6:47 PM, Jonathan Villa wrote: On Friday, 25 March 2016 at 13:58:44 UTC, Steven Schveighoffer wrote: [...] OK, the following inputs I've tested: á, é, í, ó, ú, ñ, à, è, ì, ò, ù. Just one input is enough to reproduce the behaviour. JV It's the same Ali suggested (if I get it right) and the behaviour its the same. It just get to send a UTF8 char to reproduce the mess, independently of the char type you send. At this point, I think knowing exactly what input you are sending would be helpful. Can you attach a file which has the input that causes the error? Or just paste the input into your post. -Steve The following chars I've tested: á, é, í, ó, ú, ñ, à, è, ì, ò, ù. Just one input of thouse is enough to reproduce the behaviour
Re: SDL Error: identifier expected following '.', not 'version'
Thanks!
Re: SDL Error: identifier expected following '.', not 'version'
On Sunday, 27 March 2016 at 08:52:11 UTC, Mike Parker wrote: When using Derelict, BTW, I should caution that the Sys_WM stuff in Derelict may be buggy. If you run into any odd behavior, feel free to blame it on Derelict (as long as you report it!).
Re: SDL Error: identifier expected following '.', not 'version'
On Sunday, 27 March 2016 at 07:55:10 UTC, Pedro Lopes wrote: BTW, i'm following the SDL official documentation (written for C): https://wiki.libsdl.org/SDL_GetWindowWMInfo Derelict SDL is fine, I have compiled SDL code before. I Know that the word "version" is reserved for D, but how do I circumvent this issue? Use the source, Luke! [1] Because, as you say, version is a keyword, it will not compile when used as an identifier. As such, Derelict cannot use it, so you don't need to circumvent the issue since DerelictSDL2 already has done it for you. You just need to use the correct identifier: SDL_VERSION(_); When using Derelict, in any circumstance where you run into an identifier from a C library that is the same as a D keyword, just append an underscore to it. It's possible there may be remnants of older versions of Derelict where I didn't adhere to that pattern. If you ever encounter such, please file an issue. I want to be consistent with this. [1] https://github.com/DerelictOrg/DerelictSDL2/blob/master/source/derelict/sdl2/types.d#L2069
SDL Error: identifier expected following '.', not 'version'
Hello, whenever I try to compile this chunk of code: [code] SDL_SysWMinfo info; SDL_VERSION(); if(SDL_GetWindowWMInfo(win,)) { writeln(info.subsystem); } [/code] this error shows up: Error: identifier expected following '.', not 'version' BTW, i'm following the SDL official documentation (written for C): https://wiki.libsdl.org/SDL_GetWindowWMInfo Derelict SDL is fine, I have compiled SDL code before. I Know that the word "version" is reserved for D, but how do I circumvent this issue?
Re: Does something like std.algorithm.iteration:splitter with multiple seperators exist?
On Wednesday, 23 March 2016 at 20:00:55 UTC, wobbles wrote: Again, totally untested, but I think logically it should work. ( No D compiler on this machine so it mightn't even compile :] ) Thanks Wobbles, I took your approach. There were some minor issues, here is a working version: auto multiSlice(string data, string[] delims) { import std.algorithm : canFind; import std.string : indexOf; struct MultiSliceRange { string m_str; string[] m_delims; bool empty(){ return m_str.length == 0; } void popFront(){ auto idx = findNextIndex; m_str = m_str[idx..$]; return; } string front(){ auto idx = findNextIndex; return m_str[0..idx]; } private size_t findNextIndex() { auto index = size_t.max; foreach(delim; m_delims) { if(m_str.canFind(delim)) { auto foundIndex = m_str.indexOf(delim); if(index > foundIndex && foundIndex > 0) { index = foundIndex; } } } return index; } } return MultiSliceRange(data, delims); }