Exploring calling conventions with x86 assembly

Apoorva Joshi Sept. 3, 2016, 8:24 p.m.
Excerpt:

When I was in the process of creating the OpenGL loader that I described in my last blog post, I forgot to add the WINAPI prefix to the function declarations. Someone pointed out to me on Twitter that the code would fail on 32-bit compilation. I checked, and it did. Addition of the WINAPI macro fixed this problem. The WINAPI macro expands to __stdcall on 32-bit compilation on Windows.

I had encountered stdcall and more of these mysterious keywords in the past, but only had a vague idea of what they did. And so I did some web research, dumped some assembly files, and studied a three-way diff. What follows is an analysis of cdecl, stdcall and fastcall, and how assembly code differs between these three calling conventions.

...

Full post on my blog
0 comments

Loading OpenGL without GLEW

Apoorva Joshi Aug. 20, 2016, 6:34 p.m.
Excerpt:

This article is a result of my experiences and experiments with using OpenGL for Papaya. My first few weeks learning OpenGL were challenging, because it was very different than most of the APIs I had interacted with up to that point. I’m taking Julia Evans’ advice, and hence writing this blog post because it would certainly have helped me a year ago. Intermediate or experienced programmers may want to skip this explanation entirely.

The complete OpenGL loader code described in this post is located here. Note that the code may change in the future, so the link points to the file as it existed at the time when this post was written. This code was written to cover Papaya’s usage of OpenGL. You may need to add further functions/constants manually depending on your program’s usage.

What follows, is hopefully beginner-friendly explanation.

...

Full post on my blog
3 comments

Native UI is dead, long live native UI

Apoorva Joshi Aug. 13, 2016, 6:37 p.m.
Full post on my blog

Excerpt:

I embarked on my first serious foray into programming when I was in school, equipped with a Pentium III Celeron computer, a second-hand Microsoft Press book about Visual Basic 6, and a copy of Visual Studio 6 of questionable legality. I distinctly remember visually creating facsimiles of Windows forms by dragging and dropping controls, which would come to life after running the application.

This visual designing was one of the key features of Visual Basic 6, and so was the fact that it enabled you to create native-looking UI that fit right in with Windows XP’s trademark plastic aesthetic. What is truly great is that I still get a lovely nostalgia trip every time I visit my local bank, pharmacy or restaurant, all of which use applications written in VB 6, but run them on Windows 7+. The once-native UI now looks completely out of place running on the OSes of today.

Native-looking UI was everywhere during the XP era. My web browser, word processor, calculator, IDE, looked just like the rest of my operating system. I don’t think that is the case any more. Somewhere down the line, we largely stopped caring about a having a uniform look across the operating system and its applications.

...

Full post on my blog
2 comments

The MIT License

C Apoorva Joshi April 23, 2016, 1:39 a.m.
The MIT License (MIT)

Copyright (c) 2015 Apoorva Joshi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
0 comments