Re: Is D a good choice for embedding python/octave/julia

2016-03-15 Thread Ellery Newcomer via Digitalmars-d-learn
On 03/13/2016 02:36 PM, Laeeth Isharc wrote: InterpContext context = new InterpContext(); context.py_stmts(outdent(" import numpy a = numpy.eye(2, dtype='complex128') ")); context.a.to_d!(Complex!double[][] )(); nitpicking, but the outdent is unnecessary,

Re: Calling python code from D

2016-02-27 Thread Ellery Newcomer via Digitalmars-d-learn
On Thursday, 25 February 2016 at 21:40:45 UTC, Wyatt wrote: I have a project I started in Python before I realised I really don't enjoy Python. It's been on the back-burner for a few years and I'd like to start again in D, but there's a particular python module (Mutagen) that I outright

Re: Dlang seems like java now,but why not let d more like C# Style?

2015-03-16 Thread Ellery Newcomer via Digitalmars-d-learn
On Sunday, 15 March 2015 at 14:58:54 UTC, Idan Arye wrote: Even if we can't get the lambdas as syntax tress, the fact that we can send whatever types we want to the delegates and overload operators and stuff means we can still convert the lambdas into SQL. There are limitations on operator

Re: Dlang seems like java now,but why not let d more like C# Style?

2015-03-14 Thread Ellery Newcomer via Digitalmars-d-learn
On Saturday, 14 March 2015 at 23:57:33 UTC, weaselcat wrote: On Saturday, 14 March 2015 at 23:46:28 UTC, Ellery Newcomer wrote: And C# has LINQ, which when combined with the last point is fricken awesome. what does LINQ offer that UFCS-style functional programming does not? LINQ basically

Re: Dlang seems like java now,but why not let d more like C# Style?

2015-03-14 Thread Ellery Newcomer via Digitalmars-d-learn
On Saturday, 14 March 2015 at 13:52:13 UTC, Craig Dillabaugh wrote: I don't have any C# experience so I can't compare those languages much, but I've heard people say their are D / C# similarities. Anyway, this isn't a criticism of your comment, I was just curious what (other than the

Re: embedding Pyd in Windows program

2015-03-14 Thread Ellery Newcomer via Digitalmars-d-learn
On Saturday, 14 March 2015 at 07:28:04 UTC, Matt wrote: Yeah, dub is what I'm using. Actually, I made a mistake regarding the py_eval. I'm including the pyd modules in a module other than the one that has my main() function, so they weren't visible. I feel like a proper idiot for that one..

Re: embedding Pyd in Windows program

2015-03-13 Thread Ellery Newcomer via Digitalmars-d-learn
On Friday, 13 March 2015 at 19:05:59 UTC, Matt wrote: example code, see if I can figure it out, but if you can advise, that would be fantastic. Thank you for all the help so far, it's really been appreciated My penitence for not putting this information on readthedocs. I've tried the

Re: embedding Pyd in Windows program

2015-03-13 Thread Ellery Newcomer via Digitalmars-d-learn
On Friday, 13 March 2015 at 09:38:45 UTC, Matt wrote: I used the ~0.9.4 branch in dub, and I'm not sure how to change configuration. Do you mean I should be using ~master or ~develop? nope. configurations are a different thing. you can set them in your project's dub.json. example:

Re: embedding Pyd in Windows program

2015-03-12 Thread Ellery Newcomer via Digitalmars-d-learn
On 03/11/2015 07:59 PM, Matt wrote: Right, copying site.py into my program's working dir sorts out the missing module error, but I now get a syntax error: file=sys.stderr) ^ SyntaxError: invalid syntax Error executing command run: Program exited with code 1 I googled this, and

Re: PyD-like wrapping for Excel/VBA and Julia?

2014-12-18 Thread Ellery Newcomer via Digitalmars-d-learn
On 12/18/2014 12:41 PM, Laeeth Isharc wrote: I have a bunch of D functions I would like to make available to Excel (and possibly Julia) without having to write wrappers for each function individually. I've thought about refactoring the reflection parts of pyd into a reusable library for e.g.

Re: threading issues with D - C - Python

2014-12-17 Thread Ellery Newcomer via Digitalmars-d-learn
On 12/07/2014 03:12 PM, Michael wrote: now to figure out how to use them in the general case. This is great.. Thank you. I'm looking forward to being able to try the finished result. My build servers are broken at the moment, but I think I have this fixed, on linux at least.

Re: detaching a thread from druntime 2.067

2014-12-16 Thread Ellery Newcomer via Digitalmars-d-learn
On 12/16/2014 10:41 AM, Sean Kelly wrote: On Tuesday, 16 December 2014 at 04:56:10 UTC, Ellery Newcomer wrote: If I have a thread that I need to detach from druntime, I can call thread_detachInstance, but for 2.066, this function does not exist. Is there any way to do this in 2.066? I notice

detaching a thread from druntime 2.067

2014-12-15 Thread Ellery Newcomer via Digitalmars-d-learn
If I have a thread that I need to detach from druntime, I can call thread_detachInstance, but for 2.066, this function does not exist. Is there any way to do this in 2.066? I notice there is a thread_detachByAddr, but I'm not sure how to get a ThreadAddr out of a Thread..

Re: threading issues with D - C - Python

2014-12-07 Thread Ellery Newcomer via Digitalmars-d-learn
On 12/07/2014 03:12 PM, Michael wrote: On Saturday, 6 December 2014 at 00:40:49 UTC, Ellery Newcomer wrote: On 12/04/2014 10:55 PM, Ellery Newcomer wrote: I guess tomorrow I can try messing around with thread_attachThis, as the fullcollect happening in #2 might be screwing with python data

Re: threading issues with D - C - Python

2014-12-05 Thread Ellery Newcomer via Digitalmars-d-learn
On 12/04/2014 10:55 PM, Ellery Newcomer wrote: I guess tomorrow I can try messing around with thread_attachThis, as the fullcollect happening in #2 might be screwing with python data. But you aren't really passing anything from python to d or vice versa, so I'm not sure why the gc would need

Re: threading issues with D - C - Python

2014-12-04 Thread Ellery Newcomer via Digitalmars-d-learn
On 12/04/2014 02:11 PM, Michael wrote: On Thursday, 4 December 2014 at 03:22:05 UTC, Ellery Newcomer wrote: dustmite? Not sure what went wrong with dustmite, but every time I tried it it just started deleting all the files in the directory and setup.py would give errors. I manually deleted

Re: threading issues with D - C - Python

2014-12-03 Thread Ellery Newcomer via Digitalmars-d-learn
On 12/03/2014 04:43 PM, Michael wrote: On Wednesday, 3 December 2014 at 21:35:48 UTC, ketmar via Digitalmars-d-learn wrote: ah, dsource strikes back! that vile site keep biting us again and again. let's hope that new admins will kill it for good. Yeah. I've got the new PyD and it compiles and

Re: threading issues with D - C - Python

2014-12-03 Thread Ellery Newcomer via Digitalmars-d-learn
On 12/03/2014 06:56 PM, Michael wrote: On Thursday, 4 December 2014 at 02:31:51 UTC, Ellery Newcomer wrote: okay. that's not too surprising. If you can get me a minimal example, I'd be happy to have a look since pyd should probably support this case. Cool. Unfortunately most of the times

Re: threading issues with D - C - Python

2014-12-02 Thread Ellery Newcomer via Digitalmars-d-learn
On 12/02/2014 05:07 PM, Michael wrote: Hi. I'm new here and this is my first post. I'm not sure this is the right subforum for it, but wasn't sure where else to put it either. I've written a library to talk to some external hardware using a socket. It uses the std.concurrency threads to send

Re: building shared library from D code to import into cython

2014-10-12 Thread Ellery Newcomer via Digitalmars-d-learn
On Sunday, 12 October 2014 at 16:07:19 UTC, Laeeth Isharc wrote: Any thoughts on speed in 2014 of pyd vs using cython to talk to D directly via C/C++ interface? I saw this old coment here: pyd is basically just a convenience layer on top of the C interface. The part that would most likely

Re: building shared library from D code to import into cython

2014-10-09 Thread Ellery Newcomer via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 00:25:57 UTC, Laeeth Isharc wrote: Hi. Thanks for the quick response. The -defaultlib was left around from trying all kinds of combinations of dmd and gcc. I am not used to gcc, and it will take me some time to become properly acquainted with all the

how to tell if a thing is a template

2014-08-23 Thread Ellery Newcomer via Digitalmars-d-learn
Can't think off the top of my head how you do this template IsTemplate(alias t) { ?? } static assert(IsTemplate!IsTemplate)

Re: Something like Python's psutils for D?

2014-07-12 Thread Ellery Newcomer via Digitalmars-d-learn
On Saturday, 12 July 2014 at 08:34:41 UTC, Thomas Mader wrote: The Subject says it all, is something like psutils available in D? would psutils itself be acceptable? https://bitbucket.org/ariovistus/pyd

Re: C++'s defaulted comparison operators proposal

2014-06-18 Thread Ellery Newcomer via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 05:49:30 UTC, Ali Çehreli wrote: Can you come up with a D library solution to the following C++11 proposal: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3950.html did this years ago (or something similar, at least):

Re: Linking with C on Windows

2014-06-05 Thread Ellery Newcomer via Digitalmars-d-learn
On Thursday, 5 June 2014 at 23:12:56 UTC, Mark Isaacson wrote: I need to eventually be able to export a dll that can talk with anything. how would using dmc conflict with this goal? dmd/dmc output omf object files, windows infrastructure is all coff object files. linux/mingw/etc are..

Re: Using D static library from C

2014-06-05 Thread Ellery Newcomer via Digitalmars-d-learn
On Thursday, 5 June 2014 at 18:51:25 UTC, George Sapkin wrote: I'm trying to link a simple D static library to C code, but I'm can't figure out how to do it properly without getting a segfault when running it. try this: dmd -lib test.d -defaultlib=libphobos2.a -oflibtest.a gcc main.c

Re: Using D static library from C

2014-06-05 Thread Ellery Newcomer via Digitalmars-d-learn
On Friday, 6 June 2014 at 02:17:50 UTC, George Sapkin wrote: On Friday, 6 June 2014 at 02:13:08 UTC, Ellery Newcomer wrote: On Thursday, 5 June 2014 at 18:51:25 UTC, George Sapkin wrote: I'm trying to link a simple D static library to C code, but I'm can't figure out how to do it properly

Re: dxl (the d port of jexcelapi)

2014-05-22 Thread Ellery Newcomer via Digitalmars-d-learn
On Thursday, 8 May 2014 at 20:57:08 UTC, Taylor Hillegeist wrote: So i was thinking i wonder if anyone has a d library for excel and behold there it was. however, it seems like d has grown since this was written. I'm getting bunches of errors telling me that i can't override a function

string - string literal

2014-04-20 Thread Ellery Newcomer via Digitalmars-d-learn
is there a function in phobos anywhere that takes a string and escapes it into a string literal suitable for string mixins? something like assert (f(abc\ndef) == \abc\\ndef\);

Re: Python calling D

2014-02-06 Thread Ellery Newcomer
On Tuesday, 4 February 2014 at 16:17:30 UTC, Russel Winder wrote: On Tue, 2014-02-04 at 12:45 +, Artem Tarasov wrote: But it does lead to a working system :-) Any particular reason you aren't using CeleriD to build this shared lib? CeleriD uses some hooks to call rt_init when the

Re: Python calling D

2014-02-01 Thread Ellery Newcomer
On Sunday, 26 January 2014 at 14:17:18 UTC, Russel Winder wrote: On Sun, 2014-01-26 at 12:11 +, Russel Winder wrote: […] However with Python 2 the example from: https://bitbucket.org/ariovistus/pyd/wiki/QuickStart leads to: This all sounds suspiciously like stuff I thought I'd

Re: Python calling D

2014-02-01 Thread Ellery Newcomer
On Saturday, 1 February 2014 at 22:02:24 UTC, Russel Winder wrote: My problem of the moment is segmentation faults during execution, and I have no model of how to go about providing useful data to debug this :-(( It wouldn't by any chance be related to

Re: Python calling D

2014-01-25 Thread Ellery Newcomer
On Friday, 24 January 2014 at 10:55:34 UTC, Russel Winder wrote: Probably want to use a virtualenv for this rather than install into the base installation you can also do python setup.py build python runtests.py -b hello It needs to work for Python 3.3 as well! try the latest commit

Re: Shared library: loading doesn't call shared static this

2013-12-08 Thread Ellery Newcomer
On Sunday, 8 December 2013 at 10:31:32 UTC, Mathias LANG wrote: Thank you, and yazd, it did the trick. May I ask why I don't want to call it multiple time though ? From the sentence If the runtime was already successfully initialized this returns true., I though this was handled in some way.

Re: how to compose delegate type

2013-12-08 Thread Ellery Newcomer
On Sunday, 8 December 2013 at 00:43:51 UTC, Jesse Phillips wrote: What is wrong with the current template which returns an immutable delegate type? It still store you're immutable member function. It composes the wrong type. It composes a type that has different constness than the target

Re: Shared library: loading doesn't call shared static this

2013-12-07 Thread Ellery Newcomer
On Saturday, 7 December 2013 at 20:11:15 UTC, Mathias LANG wrote: afaik, druntime does not officially support the C main, D shared library use case yet. If you have only 1 D shared library, you can insert calls to rt_init and rt_term into shared lib constructors/dtors with gcc. This has

Re: how to compose delegate type

2013-12-07 Thread Ellery Newcomer
On Saturday, 7 December 2013 at 19:36:50 UTC, Jesse Phillips wrote: This declaration doesn't make sense to me: string a() immutable { return 1; } http://dlang.org/class.html#member-functions

Re: how to compose delegate type

2013-12-06 Thread Ellery Newcomer
On 12/05/2013 09:33 PM, Jesse Phillips wrote: I don't think I understand what you mean: this code illustrates it: class Z { string a() immutable { return 1; } string b() { return 2; } } template F(t) { alias immutable(t) F; } alias typeof(Z.init.a)

how to compose delegate type

2013-12-05 Thread Ellery Newcomer
how do I construct F!(T) to yield void delegate() immutable when T is void delegate() ? [its been a long day]

core.sys.posix.termios

2013-11-23 Thread Ellery Newcomer
is there any particular reason it is missing B115200 and friends?

Re: Red-Black tree storing color without additional memory requirements

2013-11-20 Thread Ellery Newcomer
On 11/20/2013 06:50 AM, bearophile wrote: safety0ff: Since the GC supports interior pointers, I think you can justify using the least significant bits as long as the size and alignment of the pointed object guarantee that the pointer + tag will always lie inside the memory block. From:

Re: bitwise operation and type

2013-11-20 Thread Ellery Newcomer
On 11/20/2013 11:21 PM, bioinfornatics wrote: why this fail http://www.dpaste.dzfl.pl/a6d6acf4 as with c, most of the integer operators return int for integral types smaller than int. also, this is a case where a += b does something different than a = a + b i guess the former

Re: bidirectional map

2013-11-12 Thread Ellery Newcomer
On 11/11/2013 05:14 PM, bioinfornatics wrote: Dear, I am looking for a bidirectional map i.e http://en.wikipedia.org/wiki/Bidirectional_map My seach into D documentation seem to said to me that this structure is not implemented. Something like (for primary idea): struct

Re: spurious gc allocation

2013-11-09 Thread Ellery Newcomer
On 11/09/2013 12:35 AM, lomereiter wrote: Indeed, disassembly reveals an allocation (with all three compilers = it's the front-end which generates this crap). ouch. I guess the compiler incorrectly treats { node.value; } as a delegate and copies the node to GC heap. void foo() { int*

Re: spurious gc allocation

2013-11-08 Thread Ellery Newcomer
On 11/08/2013 06:19 AM, Timon Gehr wrote: On 11/08/2013 07:12 AM, Benjamin Thaut wrote: The problem is that you define the struct Thing as a inner struct. struct Thing only exists in the decompiled version, not in the original source. So far it looks like a bug to me. I've reduced it to

spurious gc allocation

2013-11-07 Thread Ellery Newcomer
hello all. I have a class member function that essentially looks like this: ThisNode* _InsertAllBut(int value) { ThisNode* node = MallocAllocator.allocate!(ThisNode)(1); node.value = value; node_count++; return node; } I compile it on x86_64 and the compiler inserts a gc

Re: PyD status and tutorials

2013-09-04 Thread Ellery Newcomer
On Saturday, 31 August 2013 at 15:44:03 UTC, Russel Winder wrote: On Sat, 2013-08-31 at 12:56 +0200, Larry wrote: Ok python3-dev was missing. Are you using Python 3.3? Are you using SCons or Tup for the build? I just tried the SCons build OOTB and it fails to build PyD with DMD :-( Ehh,

Re: DLLs: Cleaning up

2013-07-17 Thread Ellery Newcomer
On 07/17/2013 08:13 AM, Chris wrote: with some nasty surprises as regards obtaining (valid) paths on Windows as opposed to Linux / Mac. Do tell. (Any time and life saving advice about linking to other libraries / DLLs?) Thanks everyone! celerid should be up to the task.

Re: DLLs: Cleaning up

2013-07-15 Thread Ellery Newcomer
On 07/15/2013 07:18 AM, Chris wrote: doesn't work with newer versions of dmd does too. (I'm the maintainer) https://bitbucket.org/ariovistus/pyd

getter/setter in one function (almost)

2013-07-15 Thread Ellery Newcomer
unfortunately, dmd doesn't accept the signature as a valid property. import std.stdio; import std.typecons; struct T { int _i; @property int i(Nullable!int derp = Nullable!int.init) { return _i = derp.isNull ? _i : derp.get; } } void main () { T t; t.i = 1;

Re: DLLs: Cleaning up

2013-07-14 Thread Ellery Newcomer
On 07/11/2013 05:58 AM, Chris wrote: I have a DLL written in D I load into a Python application via ctypes like so: lib = CDLL(mydll) The DLL loads and can be used no problem. However, once the DLL is discarded of by the program, the program either doesn't react or crashes. I still haven't

Re: How can i increase max number recursive template expansions?

2013-07-10 Thread Ellery Newcomer
On 07/07/2013 01:22 PM, John Colvin wrote: On Sunday, 7 July 2013 at 19:55:26 UTC, QAston wrote: I have a large enum in my code (opcodes for a protocol) - using std.traits.EnumMembers gives me a recursive template error. How can i increase max number recursive template expansions? I don't

Re: [Question] Could a function return a list of arguments to call another function?

2013-06-28 Thread Ellery Newcomer
On 06/28/2013 11:07 AM, MattCoder wrote: Hi, I would like to know if it's possible to pass the return of a function as argument to another function as below: import std.stdio; auto foo(int x, int y){ writeln(x, y); return 3, 4; } void main(){ foo(foo(1,2)); } I would like to

Re: how to reflect on function attributes

2013-06-05 Thread Ellery Newcomer
On 06/05/2013 12:02 AM, Jonathan M Davis wrote: On Wednesday, June 05, 2013 08:52:35 lomereiter wrote: This doesn't work when the method is marked as @property. Any idea why is that so? On Wednesday, 5 June 2013 at 02:19:38 UTC, Jonathan M Davis wrote: is(typeof(A.func) == const) - Jonathan

how to reflect on function attributes

2013-06-04 Thread Ellery Newcomer
specifically, const, eg. class A { void func() const { blah } } std.traits.FunctionAttributes makes no mention of it

Re: how to reflect on function attributes

2013-06-04 Thread Ellery Newcomer
On 06/04/2013 07:19 PM, Jonathan M Davis wrote: On Tuesday, June 04, 2013 19:03:47 Ellery Newcomer wrote: specifically, const, eg. class A { void func() const { blah } } std.traits.FunctionAttributes makes no mention of it is(typeof(A.func) == const) - Jonathan M Davis I think

Re: how to reflect on function attributes

2013-06-04 Thread Ellery Newcomer
On 06/04/2013 07:43 PM, Jonathan M Davis wrote: On Tuesday, June 04, 2013 19:23:45 Ellery Newcomer wrote: On 06/04/2013 07:19 PM, Jonathan M Davis wrote: On Tuesday, June 04, 2013 19:03:47 Ellery Newcomer wrote: specifically, const, eg. class A { void func() const { blah

Re: how to reflect on function attributes

2013-06-04 Thread Ellery Newcomer
Ah, you're right. don't know how I screwed that up. Yes I do. I was trying to use typeof(A.func)

Re: more fun with ubuntu

2013-05-26 Thread Ellery Newcomer
On 05/25/2013 10:20 PM, estew wrote: On Sunday, 26 May 2013 at 05:01:10 UTC, Ellery Newcomer wrote: I have a project here which fails on link on ubuntu 12.10. It give undefined reference errors for functions in libdl and libutil. For some reason, ld won't cooperate unless you pass -ldl -lutil

Re: more fun with ubuntu

2013-05-26 Thread Ellery Newcomer
On 05/26/2013 07:55 AM, Jesse Phillips wrote: On Sunday, 26 May 2013 at 05:01:10 UTC, Ellery Newcomer wrote: I have a project here which fails on link on ubuntu 12.10. It give undefined reference errors for functions in libdl and libutil. For some reason, ld won't cooperate unless you pass

Re: more fun with ubuntu

2013-05-26 Thread Ellery Newcomer
On 05/26/2013 08:10 AM, Ellery Newcomer wrote: On 05/26/2013 07:55 AM, Jesse Phillips wrote: On Sunday, 26 May 2013 at 05:01:10 UTC, Ellery Newcomer wrote: I have a project here which fails on link on ubuntu 12.10. It give undefined reference errors for functions in libdl and libutil

more fun with ubuntu

2013-05-25 Thread Ellery Newcomer
I have a project here which fails on link on ubuntu 12.10. It give undefined reference errors for functions in libdl and libutil. For some reason, ld won't cooperate unless you pass -ldl -lutil at the end of the command string. Holy Ubuntu! I can't seem to get dmd to do this though. Any

Re: equivalent of __attribute__((constructor))

2013-05-24 Thread Ellery Newcomer
On 05/23/2013 11:39 PM, Jacob Carlborg wrote: On 2013-05-24 02:02, Ellery Newcomer wrote: posix.mak makes no reference to it Then I guess it's not used. Just compile it manually and link with it. I don't think that D has anything corresponding to __attribute__((constructor)). I also see

Re: equivalent of __attribute__((constructor))

2013-05-23 Thread Ellery Newcomer
On 05/22/2013 11:18 PM, Jacob Carlborg wrote: On 2013-05-23 06:27, Ellery Newcomer wrote: I don't know if it's automatically linked but here you go: https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dylib_fixes.c posix.mak makes no reference to it

equivalent of __attribute__((constructor))

2013-05-22 Thread Ellery Newcomer
In the context of shared libraries, with gcc __attribute__((constructor)) void myfunc() { .. } is used to make myfunc be called upon loading of the shared library (you can tell I know what I am talking about here) via some field in the ELF headers, apparently. Is there any way to get our

foo is not an lvalue

2013-04-17 Thread Ellery Newcomer
void main() { foo!(); } template foo( ) { void foo() { auto a = (foo); } } dmd from master (a few days ago) gives: Error: foo()() is not an lvalue wut?

Re: foo is not an lvalue

2013-04-17 Thread Ellery Newcomer
On 04/17/2013 06:02 PM, bearophile wrote: Ellery Newcomer: dmd from master (a few days ago) gives: Error: foo()() is not an lvalue wut? I think you need to write: auto a = foo!(); Bye, bearophile wouldn't that be infinitely recursing template instantiation?

Re: PyD status and tutorials

2013-04-03 Thread Ellery Newcomer
Hi. Yes, the bitbucket repo is up to date (or was, a month ago. I've been a bit busy..). It looks like you want to embed python into D, in which case the situation is better than the main page suggests. Pyd supports * CPython - 2.4 through 3.2 * dmd 2.060+ * ldc {whatever is based on dmdfe

Re: PyD status and tutorials

2013-04-03 Thread Ellery Newcomer
On 04/03/2013 05:58 PM, Ellery Newcomer wrote: Somehow I still haven't gotten around to building gdc yet, but supporting gdc for embedding python would just be a matter of updating the CeleriD configurations and ensuring everything links. Might as well do that tonight. Stay tuned. Actually

safety of move

2012-11-27 Thread Ellery Newcomer
I find myself using [abusing?] move lately: import std.algorithm; import std.stdio; struct A { const(int) i; int j; int k; } void main() { A* a = new A(); // pretend this is malloc or something // *a = A(1) A a2 = A(1); move(a2, *a); A[] arr = new A[](2);

Re: shared lib and __data_start

2012-11-12 Thread Ellery Newcomer
On 11/12/2012 12:54 AM, Johannes Pfau wrote: How did you link that shared lib? With ld, gcc or g++? If you link via gcc it pulls in some special object files, one of these could contain __data_start. g++ pulls in some more object files for c++ support, but that's probably not necessary here.

shared lib and __data_start

2012-11-11 Thread Ellery Newcomer
Playing with pypy. I build me a shared library with ldc and try to access it via ctypes, and it gives me a /usr/lib64/libdruntime-ldc.so.60: undefined symbol: __data_start So the natural question is what is __data_start? Am I right in assuming it is a symbol that points to the data section

Re: Ranges and Library and toir.c internal error

2012-10-31 Thread Ellery Newcomer
On 10/31/2012 04:35 PM, StupidIsAsStupidDoes wrote: The char call doesn't compile and I get a toir.c internal error. On a recent dmd build from github, I don't get any ICE, so it may have been fixed. I do get some disconcerting type deduction failures, though... I'm still trying to get

Re: SFML-D working example

2012-10-20 Thread Ellery Newcomer
On Saturday, 20 October 2012 at 20:25:09 UTC, Zhenya wrote: Hi!I have a little problem with building example.I downloaded SFML-D working example at this adress https://github.com/krzat/SFML-D/downloads.But then I tried to build it myself,I received many errors like that: Symbol Undefined

Re: optlink and weak symbols

2012-10-18 Thread Ellery Newcomer
On 10/17/2012 11:41 PM, Jacob Carlborg wrote: On 2012-10-18 05:12, Ellery Newcomer wrote: nice tip, but adding extern doesn't change link behavior at all. Hmm, are you linking with the DLL (the import library) ? In not, you need to use dlopen, or what the corresponding Windows function

Re: optlink and weak symbols

2012-10-18 Thread Ellery Newcomer
On 10/18/2012 11:36 AM, Jacob Carlborg wrote: On 2012-10-18 13:55, Ellery Newcomer wrote: I am using python27_digitalmars.lib, which is generated from libs\python27.lib with coffimplib, and it is linking my executables with python.dll. Ok. Do you know how the corresponding C code would look

Re: optlink and weak symbols

2012-10-17 Thread Ellery Newcomer
On 10/16/2012 11:16 PM, Jacob Carlborg wrote: You need to declare the variable as extern if it's defined in the C code: extern(C) extern __gshared PyTypeObject PyType_Type; http://dlang.org/interfaceToC.html#C%20Globals nice tip, but adding extern doesn't change link behavior at all.

optlink and weak symbols

2012-10-16 Thread Ellery Newcomer
I am interfacing with some C code [python.dll], which has some structs declared like so: PyTypeObject PyType_Type; I wish to be able to link to PyType_Type like so: extern(C) __gshared PyTypeObject PyType_Type; in linux, I can do exactly that, but optlink is generating a new memory location

function is not function

2012-09-21 Thread Ellery Newcomer
solution is to use std.traits, but can someone explain this to me? import std.stdio; void main() { auto a = { writeln(hi); }; pragma(msg, typeof(a)); // void function() pragma(msg, is(typeof(a) == delegate)); // nope! pragma(msg, is(typeof(a) == function)); // nope!

Re: function is not function

2012-09-21 Thread Ellery Newcomer
On 09/21/2012 01:10 PM, Ali Çehreli wrote: You have probably tried the following already: pragma(msg, is(typeof(a) == void function())); No, but that's also not very generic. void main() { auto a = { return 1; }; pragma(msg, is(typeof(a) == void function())); //

Re: function is not function

2012-09-21 Thread Ellery Newcomer
On 09/21/2012 01:17 PM, bearophile wrote: pragma(msg, is(typeof(a) == function)); // nope! code in pyd suggests this evaluated to true once upon a time.

Re: undefined reference to `_D6deimos6python6Python12__ModuleInfoZ'

2012-09-19 Thread Ellery Newcomer
On 09/19/2012 01:30 PM, Jesse Phillips wrote: On Tuesday, 18 September 2012 at 04:56:27 UTC, Ellery Newcomer wrote: In a templated function in my header file, I make a call to enforce. When the function is not called [instantiated], all is well. When the function is called, it generates yon

ctfe slicing

2012-09-17 Thread Ellery Newcomer
does it still copy the slice?

undefined reference to `_D6deimos6python6Python12__ModuleInfoZ'

2012-09-17 Thread Ellery Newcomer
With a deimos header file, I expect to need only to pass the dpath to it and the library it references to dmd, e.g. stuff - deimos - python - Python.d dmd otherstuff -Istuff -L-lpython2.7 I should not need to actually pass stuff/deimos/python/Python.d to dmd. Unfortunately, that is

Re: undefined reference to `_D6deimos6python6Python12__ModuleInfoZ'

2012-09-17 Thread Ellery Newcomer
On 09/17/2012 04:16 PM, Ellery Newcomer wrote: With a deimos header file, I expect to need only to pass the dpath to it and the library it references to dmd, e.g. stuff - deimos - python - Python.d dmd otherstuff -Istuff -L-lpython2.7 I should not need to actually pass stuff/deimos

Re: bigint - python long

2012-09-11 Thread Ellery Newcomer
On 09/10/2012 10:50 PM, Russel Winder wrote: Python 2 and Python 3 are totally different in this regard. I don't have a obvious proposal to make to avoid having PyD for Python 2 and a different PyD for Python 3, but the six package might have some hints as it is intended to support creating

Re: scons and D: flags

2012-09-11 Thread Ellery Newcomer
On 09/11/2012 11:42 AM, Russel Winder wrote: On Tue, 2012-09-11 at 10:40 -0700, Ellery Newcomer wrote: how do you pass compiler flags through scons? e.g. -unittest, -property Depends on the SConstruct (and optionally SConscript), but you need to get a list of the options into the DFLAGS

Re: bigint - python long

2012-09-11 Thread Ellery Newcomer
On 09/05/2012 07:10 PM, bearophile wrote: Ellery Newcomer: Yep. Oh, good. Have any suggestions for supported conversion out of the box? There are several important cases, like: Some D lazy ranges == Python lazy iterators/generators array.array == D arrays NumPy arrays == D arrays

Re: bigint - python long

2012-09-10 Thread Ellery Newcomer
On 09/05/2012 07:10 PM, bearophile wrote: NumPy arrays == D arrays I've been thinking about this one a bit more, and I am not sure it belongs in pyd. First, the conversion is not symmetric. One can convert a numpy.ndarray to a d array like so: PyObject* ndarray; double[][] matrix =

Re: bigint - python long

2012-09-10 Thread Ellery Newcomer
On 09/10/2012 12:11 PM, bearophile wrote: I understand. The point of Pyd is to interface D and Python, while NumPy is something external. So if you find difficulties just keep it out. Adding it later is possible. Thing is, pyd will convert a ndarray to d array already, it just won't do it

Re: since when was this valid syntax?

2012-09-09 Thread Ellery Newcomer
On 09/08/2012 09:01 AM, Timon Gehr wrote: On 09/08/2012 04:11 PM, Ellery Newcomer wrote: alias enum int e; It is valid according to the grammar I don't believe you. Show me the derivation.

Re: linker @_@

2012-09-08 Thread Ellery Newcomer
On 09/08/2012 03:39 AM, Johannes Pfau wrote: -L-llzmadec Woot! it worked!

since when was this valid syntax?

2012-09-08 Thread Ellery Newcomer
alias enum int e;

Re: bigint - python long

2012-09-08 Thread Ellery Newcomer
On 09/08/2012 03:09 AM, Russel Winder wrote: On Fri, 2012-09-07 at 15:21 -0700, Ellery Newcomer wrote: On 09/06/2012 12:07 AM, Russel Winder wrote: […] just used your scons fork to build the pyd embedded unittests. works pretty nice Splendid :-) Okay, here: https://bitbucket.org

offsetof + foreach

2012-09-07 Thread Ellery Newcomer
I have a struct buffer, and I want to print out its members' offsetof. This: foreach(i,_t; buffer.tupleof) { writefln(%s@: %s, _t.stringof, _t.offsetof); } complains Error: undefined identifier 'offsetof' what should I be doing?

Re: offsetof + foreach

2012-09-07 Thread Ellery Newcomer
On 09/07/2012 10:31 AM, Ellery Newcomer wrote: I have a struct buffer, and I want to print out its members' offsetof. This: foreach(i,_t; buffer.tupleof) { writefln(%s@: %s, _t.stringof, _t.offsetof); } complains Error: undefined identifier 'offsetof' what should I

Re: bigint - python long

2012-09-07 Thread Ellery Newcomer
On 09/06/2012 09:48 AM, Ellery Newcomer wrote: On 09/05/2012 11:19 PM, Jacob Carlborg wr Associative arrays? check. eh, that was check as in yes, not check as in look it up yourself. didn't seem ambiguous at the time.

Re: bigint - python long

2012-09-07 Thread Ellery Newcomer
On 09/06/2012 12:07 AM, Russel Winder wrote: I am guessing this is interfacing to CPython, remember there is also PyPy and ActiveState, they have different ways of doing things. Well the ActiveState C API will be very close to the CPython C API, but PyPy (which is the best Python 2.7 just now)

linker @_@

2012-09-07 Thread Ellery Newcomer
playing with some old headers I had lying around, dmd libdw_test.d {{header files}} -L-ldw gives me /usr/bin/ld: /usr/lib64/dmd-2.060/libphobos2.a(memory_4a8_620.o): undefined reference to symbol '_end' /usr/bin/ld: note: '_end' is defined in DSO /lib64/liblzma.so.5 so try adding it to the

int[3][4]*

2012-09-07 Thread Ellery Newcomer
alright what's the deal? void main () { alias int[3][4] fooz; int[3][4]* i = new fooz; } wiz.d(6): Error: new can only create structs, dynamic arrays or class objects, not int[3LU][4LU]'s

  1   2   3   4   >