Page 1 of 1

Article on C++ - ASM linkage up has been added.

Posted: Tue Oct 27, 2009 2:08 am
by gravaera
This is another commonly asked newcomer question, so placing a good article on the subject in the WIki should be useful.

I found that in order to explain linking to C++ class methods from within ASM, I would have had to explain the C++ 'this' pointer, so I've decided to write a separate article on that within the next ~1-2 weeks.

In the meantime, for an article which discusses C-C++-ASM inter-linkage, try here: http://wiki.osdev.org/C%2B%2B_to_ASM_linkage_in_GCC

-All the best
gravaera

Re: Article on C++ - ASM linkage up has been added.

Posted: Tue Oct 27, 2009 4:45 am
by neon
Nice idea. I can probably write an artical for using NASM with MSVC for those interested as well sense you cant use MASM for OS development :)

Re: Article on C++ - ASM linkage up has been added.

Posted: Tue Oct 27, 2009 5:07 am
by gravaera
By all means: please do. My aim really is to eventually give a full, comprehensive set of articles on C++ kernel development with the relevant information needed, such as issues to do with distributing kernel resources to C programs in user space.

This is usually complicated by the C++ 'this' pointer. I'm going to slowly work on getting everything needed to set up a quality C++ kernel into the Wiki. I read from your tutorials that you like to use C++. Feel free to pitch in :) .

-All the best
gravaera.

Re: Article on C++ - ASM linkage up has been added.

Posted: Tue Oct 27, 2009 12:26 pm
by fronty
neon wrote:Nice idea. I can probably write an artical for using NASM with MSVC for those interested as well sense you cant use MASM for OS development :)
I just downloaded MASM and read whole licence (not French part). I didn't see anything which would prohibit usage of MASM in operating system development. Could you tell me which part I misunderstood/didn't understand completely?

Re: Article on C++ - ASM linkage up has been added.

Posted: Tue Oct 27, 2009 4:14 pm
by neon
fronty wrote:I just downloaded MASM and read whole licence (not French part). I didn't see anything which would prohibit usage of MASM in operating system development. Could you tell me which part I misunderstood/didn't understand completely?
Online license emphasizing:
license wrote:What you CANNOT do with the MASM32 Project.
...
4. You cannot use the MASM32 Project to write software for Non-Microsoft Operating Systems.

Re: Article on C++ - ASM linkage up has been added.

Posted: Tue Oct 27, 2009 4:45 pm
by fronty
Download MASM installer from here. When you run the installer, it will show you the licence.
Licence wrote:MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT MACRO ASSEMBLER

These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft
* updates,
* supplements,
* Internet-based services, and
* support services
for this software, unless other terms accompany those items. If so, those terms apply.
By using the software, you accept these terms. If you do not accept them, do not use the software.
If you comply with these license terms, you have the rights below.

1. INSTALLATION AND USE RIGHTS. You may install and use one copy of the software on your device to design, develop and test your programs for non-commercial purposes. You may not use the software to develop programs you either intend to distribute for a fee or use to maintain your own business or IT systems.
2. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not
* disclose the results of any benchmark tests of the software to any third party without Microsoft’s prior written approval;
* work around any technical limitations in the software;
* reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;
* make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation;
* publish the software for others to copy;
* rent, lease or lend the software;
* transfer the software or this agreement to any third party; or
* use the software for commercial software hosting services.
3. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall the software.
4. DOCUMENTATION. Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.
5. EXPORT RESTRICTIONS. The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting.
6. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.
7. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.
8. APPLICABLE LAW.
a. United States. If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.
b. Outside the United States. If you acquired the software in any other country, the laws of that country apply.
9. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.
10. DISCLAIMER OF WARRANTY. The software is licensed “as-is.” You bear the risk of using it. Microsoft gives no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this agreement cannot change. To the extent permitted under your local laws, Microsoft excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
11. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. You can recover from Microsoft and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.
This limitation applies to
* anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and
* claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.

It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.

Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.
Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français.
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft n’accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection dues consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, d’adéquation à un usage particulier et d’absence de contrefaçon sont exclues.
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.
Cette limitation concerne :
* tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et
* les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou d’une autre faute dans la limite autorisée par la loi en vigueur.
Elle s’applique également, même si Microsoft connaissait ou devrait connaître l’éventualité d’un tel dommage. Si votre pays n’autorise pas l’exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l’exclusion ci-dessus ne s’appliquera pas à votre égard.
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas.
Maybe you can't use some third party software to develop using MASM, but I don't see any reason why you couldn't use MASM.

Re: Article on C++ - ASM linkage up has been added.

Posted: Tue Oct 27, 2009 9:12 pm
by Firestryke31
Aren't MASM and MASM32 two different projects?

Re: Article on C++ - ASM linkage up has been added.

Posted: Wed Oct 28, 2009 12:49 am
by tantrikwizard
Firestryke31 wrote:Aren't MASM and MASM32 two different projects?
Yes, keep it safe and use JWASM ;) It buries all versions of MASM hands down.

Re: Article on C++ - ASM linkage up has been added.

Posted: Wed Oct 28, 2009 2:28 am
by Combuster
I think ought to be enough to kick anybody off MASM:
You may not use the software to develop programs you either intend to distribute for a fee or use to maintain your own business or IT systems.
I want a lawyer to explain if "not for maintaining your own IT system" includes non-MS operating systems... At least this clause makes it non-compatible with GPL or BSD...

Re: Article on C++ - ASM linkage up has been added.

Posted: Wed Oct 28, 2009 3:25 am
by Solar
@ fronty: You just violated the license...
[You may not] transfer the software or this agreement to any third party...
This one is also great:
[You may not] disclose the results of any benchmark tests of the software to any third party without Microsoft’s prior written approval;
* work around any technical limitations in the software;
:-k

Re: Article on C++ - ASM linkage up has been added.

Posted: Wed Oct 28, 2009 10:20 am
by Owen
"Transfer the software or this agreement" refers to transferring the contract between you and Microsoft, not the EULA text, AFAIK, though IANAL.

Re: Article on C++ - ASM linkage up has been added.

Posted: Sun Nov 01, 2009 1:30 pm
by neon
Aye, I may have been confusing MASM and MASM32. I thought they were the same (Its been awhile sense i used MASM.) Thanks for the correction :)