NO

Author Topic: WCRT C runtime library with source  (Read 17090 times)

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
WCRT C runtime library with source
« on: September 20, 2004, 12:47:55 PM »
WCRT is a small C runtime library for Visual C++, which implements parts of its functionality through calls to the Win32API. It is meant as a replacement for the Visual C runtime library (libc.lib) for small projects. Source included.

Version 1.12 has just been released. Works with Pelles C from v1.08.

http://www.ibsensoftware.com

Pelle
/Pelle

RJP Computing

  • Guest
WCRT C runtime library with source
« Reply #1 on: September 20, 2004, 03:30:32 PM »
How would a person use this in PellesC IDE? Sorry a newbie question. :wink:

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
WCRT C runtime library with source
« Reply #2 on: September 21, 2004, 02:20:58 AM »
I have attached a project file for Pelles C - can at least be used as a starting point. Requires MASM, which can be found here: http://www.masm32.com/

(Check Project Options, Macros tab, AS macro, in case the path needs to be changed).

Pelle
/Pelle

RJP Computing

  • Guest
WCRT C runtime library with source
« Reply #3 on: September 21, 2004, 06:12:35 AM »
Hi Pelles,

Thanks but I think you didn't attach it to the forum. Is it on the main website?

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
WCRT C runtime library with source
« Reply #4 on: September 21, 2004, 07:33:37 AM »
I didn't notice that. Sorry. Wrong file extension - not accepted. We try again...

Pelle
/Pelle

RJP Computing

  • Guest
WCRT C runtime library with source
« Reply #5 on: September 21, 2004, 03:55:00 PM »
Thanks

RJP Computing

  • Guest
WCRT C runtime library with source
« Reply #6 on: September 22, 2004, 08:44:44 PM »
I am sorry if I am repeating this topic again. I did look at you project file example but it appears to be how to actually compile the wcrt. So I have another "thick-headed" question for you. How do I use the wcrt.lib when creating a new program. I want to utilize the wcrt but I don't know how to tell poide to use this crt and not your default.

Jibz

  • Guest
WCRT C runtime library with source
« Reply #7 on: September 22, 2004, 09:26:42 PM »
Here is what I did to build a first test application:
[list=1]
  • Open/create a project
  • From the menu, select Project->Project Options ...
  • Under the Linker tab, add wcrt.lib with path under Library and object files
  • Under the Macros tab, add -I<path to wcrt include dir> at the end of the CCFLAGS macro
  • Click OK
  • Try building your project :)
  • [/list:o]
    As an example, my CCFLAGS for the project were:
Code: [Select]
-W1 -Ot -Gd -Tx86-coff -Ic:\wcrt\include
and the libraries listed under the Linker tab were:
Code: [Select]
kernel32.lib advapi32.lib delayimp.lib c:\wcrt\lib\wcrt.lib
Hope this helps :).

RJP Computing

  • Guest
WCRT C runtime library with source
« Reply #8 on: September 23, 2004, 04:25:52 PM »
Yes. That did it.

I do get this warning.
Quote
POLINK: warning: Multiple '.rdata' sections found with different attributes (0x40000040 and 0xc0000040).

But it still runs just fine. What does this warning mean?
Thanks

EDIT: You can just drop the 'wcrt.lib' file in the PellesC 'Lib' directory and add this
Code: [Select]
#pragma comment(lib,"wcrt.lib")to the top of your code and it works great. This way if you want to switch back and forth between PellesC standard crt and the WCRT you can.

Jibz

  • Guest
WCRT C runtime library with source
« Reply #9 on: September 23, 2004, 05:25:02 PM »
As far as I know, the warning comes from a difference in the flags on the section containing C initializers between Visual C++ and Pelles C.

VC++ puts them in a section with read/write access (0xC0000040), whereas Pelles C puts them in the read-only section (0x40000040). Also it appears that Pelles C is merging them with the .rdata section, where VC++ merges them with the .data section.

However I do not know the details of Pelles C, so perhaps Pelle could shed some further light on this?

At any rate, it should not produce any problems other than the warning message when linking :).

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
WCRT C runtime library with source
« Reply #10 on: September 23, 2004, 06:18:39 PM »
Jibz is absolutely correct.

Function pointers from #pragma startup/exit (or equivalent) are stored in a section called .CRT, which is merged with the .rdata section (read-only data) by POLINK. Microsoft merge .CRT with the .data section (read-write data). Not really sure why - might be a C++ thing. I should probably change this...

Pelle
/Pelle