Win32的C运行时库 [英] C runtime library for Win32

查看:84
本文介绍了Win32的C运行时库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为DOS,OS / 2和MVS编写了一个公共域(不是GPL等)C运行时库

http://sourceforge.net / projects / pdos /

我现在希望将它移植到Win32,以便我可以创建可执行文件

在Windows 98命令下运行提示可执行文件的每个字节

来自公共域代码。


我只对写严格符合C89程序感兴趣,

即TTY计划。 PDPCLIB没有扩展名。


我安装了gcc(egcs 2.91.57),它附带了Cygwin,

我很乐意使用gcc作为我的编译器,但我不想

使用任何GNU库。我基本上想通过调用一些Windows API来实现

fopen / fread / etc,类似于OS / 2.


我在网上做了一些阅读,看起来

相当于OS / 2的DosOpen()是CreateFile()。什么是打开现有文件的函数的奇怪名称
!所以首先

我想确认我找到了合适的API。

我发现这里:

http:/ /msdn.microsoft.com/library/de...ning_files.asp


其次,我想知道我需要用什么程序来启动

编写调用这些Win32 API的应用程序,而不在GNU库中链接

。如果我只是正常使用gcc,它将自动在GNU库中链接
。我可以使用gcc -nostdinc强制gcc到

只从我指定的目录中选择标题。我如何使用
强制gcc不与普通库链接?我是否需要

使用gcc -c和ld我?什么是语法,以便我创建

正常的32位Windows命令行可执行文件?


另外,如何通过Win32 API写入stdout ?我是否需要

来创建一个CreateFile()或者是否已经存在一个合适的句柄?

我想得到一个hello,world程序首先工作,激励

我做其余的工作。


我需要在OS / 2中编写汇编程序作为可执行文件

入口点。我是否也需要Win32的那个?


我之前从未做过Windows编程,很抱歉

新手问题。我真的不确定如何开始。


谢谢。保罗。

I have written a public domain (not GPL etc) C runtime library
(PDPCLIB) for DOS, OS/2 and MVS. You can see it here:

http://sourceforge.net/projects/pdos/

I now wish to port it to Win32, so that I can create executables
to run under Windows 98 command prompt where every byte
of the executable is from public domain code.

I''m only interested in writing strictly conforming C89 programs,
ie TTY programs. PDPCLIB has no extensions.

I have gcc (egcs 2.91.57) installed, which came with Cygwin,
and I am happy to use gcc as my compiler, but I don''t want to
use any GNU libraries. I basically want to implement
fopen/fread/etc by calling some Windows API, similar to OS/2.

I have done some reading on the web, and it would appear that
the equivalent of OS/2''s DosOpen() is CreateFile(). What a
strange name for a function that opens existing files! So first
of all I would like to confirm that I''ve found the right API.
I found that here:

http://msdn.microsoft.com/library/de...ning_files.asp

Secondly, I''d like to know what process I need to use to start
writing applications that call these Win32 APIs without linking
in GNU libraries. If I just use gcc normally it will automatically
link in GNU libraries. I can use "gcc -nostdinc" to force gcc to
only pick headers up from my specified directories. How do I
force gcc to not link with the normal libraries? Do I need to
use "gcc -c" and "ld" myself? What is the syntax, so that I create
normal 32-bit Windows command line executables?

Also, how do I write to stdout via the Win32 API? Do I need
to do a CreateFile() or does a suitable handle already exist?
I''d like to get a "hello, world" program working first, to inspire
me to do the rest of the work.

I needed to write an assembler program in OS/2 as the executable
entry point. Do I need that for Win32 as well?

I''ve never done Windows programming before, so sorry for the
newbie questions. I''m really not sure how to get started.

Thanks. Paul.

推荐答案

文章< 45 ********************** @ un-2park-reader-01.sydney.pipenetworks.com.au>,

Paul Edwards< ke ****** @ nosppaam.w3.towrote:
In article <45**********************@un-2park-reader-01.sydney.pipenetworks.com.au>,
Paul Edwards <ke******@nosppaam.w3.towrote:

>我为DOS,OS / 2和MVS编写了一个公共域(不是GPL等)C运行时库(PDPCLIB)。你可以在这里看到:

http://sourceforge.net / projects / pdos /

我现在希望将它移植到Win32,以便我可以创建可执行文件
在Windows 98命令提示符下运行每个字节
可执行文件来自公共域代码。
>I have written a public domain (not GPL etc) C runtime library
(PDPCLIB) for DOS, OS/2 and MVS. You can see it here:

http://sourceforge.net/projects/pdos/

I now wish to port it to Win32, so that I can create executables
to run under Windows 98 command prompt where every byte
of the executable is from public domain code.



这是一个非常值得称道的项目;我可以调查一下。


不幸的是,现在任何时候,一些dorkbrain会告诉你

你是偏离主题的。做好准备。

This is a very commendable project; I may look into it.

Unfortunately, any minute now, some dorkbrain is going to tell you that
you are off-topic. Be prepared for it.


Paul Edwards写道:
Paul Edwards wrote:

我写了一个公共域名(不是GPL等)C运行时库

(PDPCLIB)用于DOS,OS / 2和MVS。你可以在这里看到:

http://sourceforge.net / projects / pdos /

我现在希望将它移植到Win32,以便我可以创建可执行文件

在Windows 98命令下运行提示可执行文件的每个字节

来自公共域代码。
I have written a public domain (not GPL etc) C runtime library
(PDPCLIB) for DOS, OS/2 and MVS. You can see it here:

http://sourceforge.net/projects/pdos/

I now wish to port it to Win32, so that I can create executables
to run under Windows 98 command prompt where every byte
of the executable is from public domain code.



考虑重新改写而不是端口。


< snip>

Consider a fresh rewrite instead of a port.

<snip>


其次,我想知道我需要用什么进程来启动

编写调用这些Win32 API的应用程序而不连接

in GNU库。如果我只是正常使用gcc,它将自动在GNU库中链接
。我可以使用gcc -nostdinc强制gcc到

只从我指定的目录中选择标题。我如何使用
强制gcc不与普通库链接?我是否需要

使用gcc -c和ld我?什么是语法,以便我创建

正常的32位Windows命令行可执行文件?
Secondly, I''d like to know what process I need to use to start
writing applications that call these Win32 APIs without linking
in GNU libraries. If I just use gcc normally it will automatically
link in GNU libraries. I can use "gcc -nostdinc" to force gcc to
only pick headers up from my specified directories. How do I
force gcc to not link with the normal libraries? Do I need to
use "gcc -c" and "ld" myself? What is the syntax, so that I create
normal 32-bit Windows command line executables?



你可能需要比-nostdinc更多的选项。从长远来看,以最佳方式完全阅读gcc

和ld手册。

You''ll probably need more options than -nostdinc. Fully reading the gcc
and ld manuals in the best way int the long run.


此外,我如何通过以下方式写入stdout Win32 API?
Also, how do I write to stdout via the Win32 API?



使用WriteFile()。同样最好的策略是下载并安装MS提供的

平台SDK。

Use WriteFile(). Again the best strategy is to download and install the
Platform SDK supplied by MS.


我需要在OS /中编写汇编程序2作为可执行文件

入口点。我也需要Win32吗?
I needed to write an assembler program in OS/2 as the executable
entry point. Do I need that for Win32 as well?



是的,标准库的启动代码必须有一些

程序集,但它只需要最小化和32位x86组装非常类似于16位平板型号。

Yes, the standard library''s startup code will have to have some
assembly but it needs only be minimul and 32 bit x86 assembly is very
similar to 16 bit flat model.


我之前从未做过Windows编程,很抱歉

新手问题。我真的不确定如何开始。
I''ve never done Windows programming before, so sorry for the
newbie questions. I''m really not sure how to get started.



为什么你不能尝试一些小练习应用程序才能毕业到

移植/重写C库?


无论如何,Windows相关的问题将在更多

特定群体(如comp.os.ms-windows.programmer等)上得到最好的解答。另外还需要

查看MinGW的运行时库或lcc-win32的标准

库的来源,以了解您必须做的事情。完全90%的更改

将是系统调用。不幸的是,Windows API远远不够简单,你必须花费*相当多的时间在MSDN上并使用

Platform SDK才能做到正确。

Why don''t you try a few small practise apps before graduating to
porting/rewriting the C library?

Anyway, Windows related questions will be best answered on more
specific groups like comp.os.ms-windows.programmer etc. Also take a
peek at the sources for MinGW''s runtime library or lcc-win32''s standard
library to get a feel for what you must do. Fully 90% of the changes
would be the system calls. Unfortunately the Windows API is far from
simple and you''ll have to spend *considerable* time on MSDN and with
Platform SDK before getting it right.


santosh说:


< snip>
santosh said:

<snip>

不幸的是,Windows API远非

简单
Unfortunately the Windows API is far from
simple



足够真实。不过,它相当容易。

True enough. Nevertheless, it''s reasonably easy.


你将不得不在MSDN上花费*相当多的时间和

平台SDK之前做对了。
and you''ll have to spend *considerable* time on MSDN and with
Platform SDK before getting it right.



不是。 C是C.Win32 API是Just Another API。没有汗水。 :-)


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:正常服务将尽快恢复。请不要

调整您的电子邮件客户端。

Not really. C is C. The Win32 API is Just Another API. No sweat. :-)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: normal service will be restored as soon as possible. Please do not
adjust your email clients.


这篇关于Win32的C运行时库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆