Linking phobos64.lib errors

2023-02-28 Thread Elfstone via Digitalmars-d-learn

https://forum.dlang.org/post/edwmddiqcsnwpliyo...@forum.dlang.org

On Wednesday, 3 September 2014 at 09:13:52 UTC, Szymon Gatner 
wrote:
On Wednesday, 3 September 2014 at 08:47:35 UTC, Rikki 
Cattermole wrote:

On 3/09/2014 7:22 p.m., Szymon Gatner wrote:

[...]


My gut feeling looking at that, is that its not linking 
against the c runtime.


For reference I'm pretty sure _deh_beg is related to exception 
handling.


Hey, for some reason I missed this:

http://forum.dlang.org/thread/ji93fh$15ph$1...@digitalmars.com

The fix is to add main() function to D library. Don't know why 
it is needed for static lib but it sure helps to resolve link 
issues.


Strangely I just got similar link errors (phobos64.lib ... 
unresolved ...) building dynamic lib on Win11 (no errors on 
Win10, or with ldc). I found this thread and adding main() saved 
me.


Any expert can explain why and when main() is needed for dynamic, 
or static lib?


Re: stdin.readln line editing and recall with up arrow

2023-02-28 Thread Daren Scot Wilson via Digitalmars-d-learn
On Saturday, 25 February 2023 at 08:47:42 UTC, Richard (Rikki) 
Andrew Cattermole wrote:

On 25/02/2023 9:45 PM, Daren Scot Wilson wrote:
I went with readline.  Left/right arrows work, but up arrow 
still does not recall earlier commands. Maybe I need also a 
separate input history thing?


https://tiswww.case.edu/php/chet/readline/readline.html#Basic-Behavior


Hmm... the add_history(), or maybe it's rl_add_history(), 
function seems to have been in ancient readline versions but at 
some point all line history code was taken out to be its own 
library.


https://tiswww.case.edu/php/chet/readline/rltop.html
https://tiswww.case.edu/php/chet/readline/history.html

Arch Linux drags in both readline.so and history.so in its 
readline package. No one notices!



Trying import gnu.history;  fails since there's no distinct 
'history' package (yet) and Dub doesn't drag it in along with 
readline.


D can call C and link to anything in /usr/lib easily. Done. It 
works!   How does D know to link to the libhistory.so library?  I 
didn't say "history" anywhere.  But it works.


extern (C) {
void add_history(const char*);
}


I'm tempted to make a history package and submit it to DUB. 
Maybe. After dinner...