Constant strings are not not working [this is not a FAQ]

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Constant strings are not not working [this is not a FAQ]

Post by Chandra »

I forgot to write one important thing in my previous post about the problem of constant strings which obliged me to write this post. My previous post was locked.
Okay first things first. I've been writing a 16 bit O.S with GUI and extended memory support. I have been really annoyed my constant strings which don't work properly. I have posted this problem before but everyone out there suggest me to read the FAQ section about using proper linker script. I had already used the proper linker script ( the one that include *.rodata, *.rdata etc.) but it didn't work for me. I tried to post my problem to find a proper solution but everyone who reads my post suggest me to read the FAQ about linker script, which in fact is not the solution for me.
If anyone knows any other solution for working constant strings please please please post your reply. I would highly appreciate any reply hereby.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Constant strings are not not working [this is not a FAQ]

Post by Solar »

*sigh*
Solar wrote:What stuns me every time is how people seem to skip the debugging phase completely. The question always is "I write this code, and it doesn't work". The question never is "I write this code, and the string doesn't end up in the binary" or somesuch...
Every good solution is obvious once you've found it.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Constant strings are not not working [this is not a FAQ]

Post by jal »

Chandra wrote:My previous post was locked.
Although I have not read it, probably for a good reason.
If anyone knows any other solution for working constant strings please please please post your reply.
I won't suggest reading the FAQ, as you mention alread doing that. However, you do not describe your problem here, nor do you detail what you have already done to find out where the problem is. And no, I do not feel like checking another thread, locked for good reason, to find out. If you need help, detail what the problem is and what you already did to solve it.

EDIT: I did read the previous post, and you indeed do not seem to have done any debugging.


JAL
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Constant strings are not not working [this is not a FAQ]

Post by Combuster »

Since any reply is appreciated, maybe this helps: :twisted:

Image
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
hailstorm
Member
Member
Posts: 110
Joined: Wed Nov 02, 2005 12:00 am
Location: The Netherlands

Re: Constant strings are not not working [this is not a FAQ]

Post by hailstorm »

@Combuster: LOL :mrgreen:

Chandra,

Did you allready debug your os at the point where things go wrong? Have you ever considered to do any research in or on your code? As for what I read in your post, you did nothing like that. At which offset does your string reside in the executable, where is it loaded at boottime? In other words, know what you should expect from your code and check if your expectations are met. Check the cpu's registers using the Bochs debugger. You have to know why it doesn't work, and it has probably nothing to do with your linker, since that is just an assumption that you're making.

Good luck with finding the source of your problem.

~Greetz~
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: Constant strings are not not working [this is not a FAQ]

Post by Chandra »

Thanks for suggesting me to debug. Yeah, I found what was the problem, the problem was with the compiler's 16 bit generated code. It put my constant string somewhere else neither at the code segment nor at the data segment. I recently resolved the problem and the solution was to jump to 32 bit mode.
And it worked .............................
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Post Reply