News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Building alternate RTL for MASM32

Started by Adamanteus, December 23, 2007, 07:14:27 PM

Previous topic - Next topic

Adamanteus

 Deal is about msvcrt.inc that is used substitutions to somehow strange named functions _imp___kbhit.
I want to emulate this, but don't know how it's originally made ?
Possible, and good idea to remap it to names as _kbhit - as default leading underscore added automatically for C routines. But assembler adds more one so making __kbhit. Is it possible to avoid add underscore to some options, except syscall, because it's not linked with c-functions, as I defined externdef syscall _kbhit. ::)

hutch--

The problem is many of the names in MSVCRT are illegal names in MASM, thats why the method for using in the masm32 project prefixed the names with crt_*****. Apart from a minor increase in typing it works fine.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Adamanteus

It's clear that if to delete all prefixes in msvcrt.inc will be keywords, but hows to lib file that building not by def file, but by sources is to make substitutes to crt__xxx. Them remap possible only throw one leading underscore, but it's doubling by assembler. So not to delete not to use - only with some long prefix, that I don't know how's to add - not found this option if it is at all.

Vortex

Adamanteus,

Can you be more specific? Maybe, I can help you to if you would give an example about what you would like to achieve.

Adamanteus

It's need make tool makecimp that to make alternate msvcrt.inc, than make own lib by normal named functions for example kbhit. Than is need to substitute this functions to crt__kbhit in m32lib library.

[attachment deleted by admin]

Vortex


Adamanteus

Yes, thank You. It helped such that was need to write proto syscall insted of externdef syscall - by what is difference difficult to understand, it seems Microsoft fault.
But sorry appaped new hidden mistake under name "_strerror" - referenced from masm32.lib - but not found in it's code. I'm not sure that somebody met such problem, but if is ? :dazzled:

hutch--

Adamanteus,

There are a couple of simple choices for you if you want closer to the original names. Both Vortex and I have produced tools to make the include files and as they simply produce equates for names you can change them to whatever you like.

I personally prefer the crt_ prefix because it allows you to use any of the other CRT runtime libraries which often have the same names for some functions. Just change the prefix for any DLL you can get the function names for and you can run parallel DLLs with identical function names just be changing the prefix on the equate name.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Vortex

Hi Adamanteus,

_strerror is not a member of masm32.lib This function is exported by msvcrt.dll

Adamanteus

Thanks, it's I also found - except it strange linking to programs that absolutely not using it. Linked I already everything successfully but happend to copy stubs of libraries with names fmtcmt.lib and oldnames.lib to lib folder. Found option /NODEFAULTLIB for librarian, but it seems absolutely not helping that do discard referenced on this libraries in my clear of it indeed.

Vortex

Adamanteus,

I guess you are using libraries from Visual Studio. Try to use the version of msvcrt.lib supplied with the Masm32 package, it does not depend on other libraries.

Adamanteus

No I'm using msvcrt.lib of my own it's K-Lib, and everything now well working, except that on it 2.5K program becalmed 64K, but it's as used such and I don't know why on original is mach smaller ?

hutch--

Without knowing the details it sounds like you have pulled in the C runtime libraries which will bloat your code with its size.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Adamanteus

Yes it so, here is attached bloat example, also I just begun porting code and working only it.

[attachment deleted by admin]

Vortex

Hi Adamanteus,

I removed the macros from the source file. I see that you are using another version of msvcrt.lib, it has a different set of exported functions :

LIBRARY msvcrt
EXPORTS
"FIARQQ"
"FICRQQ"
"FIDRQQ"
"FIERQQ"
"FISRQQ"
"FIWRQQ"
"FJARQQ"
"FJCRQQ"
"FJERQQ"
"FJSRQQ"
"DosErrorOperating"
.
.
.


Size decreased from 66048 bytes to 1536 bytes.


[attachment deleted by admin]