Re: Continuous integration testing with travis and drone

2014-07-16 Thread Pavel via Digitalmars-d

On Wednesday, 16 July 2014 at 04:11:28 UTC, Kapps wrote:
On Wednesday, 16 July 2014 at 03:31:13 UTC, Pavel Evstigneev 
wrote:

May I improve forum to support markdown?


The forum is actually an interface to a newsgroup, so most 
forms of markdown would not be supported in the interest of 
having a consistent UI for people who use mail / newsgroup 
clients vs people who use the online web interface.


Well, we can serve html in newsgroup/emails, or as plain text 
with striped markdown's markup


For example user writes "hello, **people**", on online interface 
its "hello, people", in plain text format (for 
people who dislike html) it's: "hello, people". I don'y think we 
should give markdown as plain text, or we should limit features, 
for example only titles, code blocks, horisontal line, links.


Everything is still same, but code snippets and links looks nice 
on web ui.


How you think?


Re: PHP extension in D

2014-07-11 Thread Pavel via Digitalmars-d
Sure, I will write the how-to-do article, if I have plenty of 
time the next week. If not, I will write it later. All in all, 
the article soon will be ready.


Re: PHP extension in D

2014-07-10 Thread Pavel via Digitalmars-d

On Wednesday, 9 July 2014 at 23:42:22 UTC, Joakim wrote:

On Wednesday, 9 July 2014 at 21:30:45 UTC, Pavel wrote:

Hello!

I've reproduced steps 1-9 on my Ubuntu 14.04 x64 machine, but 
now I have this errors:


root@dlang:~/phpext# dmd -shared speedup_wrap.o dfakemain.o 
speedup.o -ofspeedup.so
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(lifetime_485_6c8.o): 
relocation R_X86_64_32 against `_D15TypeInfo_Shared7__ClassZ' 
can not be used when making a shared object; recompile with 
-fPIC
/usr/lib/x86_64-linux-gnu/libphobos2.a: error adding symbols: 
Bad value

collect2: error: ld returned 1 exit status
--- errorlevel 1


I'm new to D/C languages, so what can I do to fix this error? 
I tried to compile with "-fPIC" option at all appropriate 
steps, but nothing helps :(


I think Rémy's advice is a little outdated when dealing with 
shared libraries, which are now supported on linux, so the fake 
main is not necessary there anymore:


http://dlang.org/dll-linux.html#dso7

Try linking to phobos as a shared library as shown there and 
then calling the D function, I believe it should work (you'll 
also need to call rt_init() before the D library and rt_term() 
after).


Thank you very much for advice, it helped me :) Here is my 
build.sh file after all experiments:


#!/bin/sh
swig -php speedup.i
dmd -m64 -fPIC -c -L-shared speedup.d
sed -i "1i char* d_speedUp(char* arg1);" speedup_wrap.c
gcc `php-config --includes` -fpic -c speedup_wrap.c
dmd -m64 -shared -defaultlib=libphobos2.so 
-I/usr/lib/x86_64-linux-gnu speedup_wrap.o speedup.o -ofspeedup.so


Note that we need to insert d_speedUp() function definition in 
speedup_wrap.c file, otherwise there will be a warning "cast to 
pointer" and segmentation fault when using compiled speedup.so 
file:

speedup_wrap.c: In function ‘_wrap_d_speedUp’:
speedup_wrap.c:1141:12: warning: cast to pointer from integer of 
different size [-Wint-to-pointer-cast]


Also I found no mention about rt_term() method in generated 
files, so my php script works without it.

   result = (char *)d_speedUp(arg1);




Re: PHP extension in D

2014-07-09 Thread Pavel via Digitalmars-d

Hello!

I've reproduced steps 1-9 on my Ubuntu 14.04 x64 machine, but now 
I have this errors:


root@dlang:~/phpext# dmd -shared speedup_wrap.o dfakemain.o 
speedup.o -ofspeedup.so
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(lifetime_485_6c8.o): 
relocation R_X86_64_32 against `_D15TypeInfo_Shared7__ClassZ' can 
not be used when making a shared object; recompile with -fPIC
/usr/lib/x86_64-linux-gnu/libphobos2.a: error adding symbols: Bad 
value

collect2: error: ld returned 1 exit status
--- errorlevel 1


I'm new to D/C languages, so what can I do to fix this error? I 
tried to compile with "-fPIC" option at all appropriate steps, 
but nothing helps :(