I would like to port PDPCLIB: http://sourceforge.net/projects/pdos/
my public domain C runtime library for DOS, OS/2,
Win32, MVS to Unix now.
I am a bit perplexed as to how to do this. Unix/Posix
systems provide open() with which I can implement
fopen(). But then Posix is also required to define fopen(),
so this is not the level at which I need to implement it.
Although I don't think the CRT should be polluting the
namespace by using open() in the first place.
If the lower level is platform-dependent, then the platform
I wish to target is Linux.
Can someone get me started?
Thanks. Paul.
Nov 17 '06
21 3108
"Paul Edwards" <ke******@nospp aam.w3.towrites :
"Keith Thompson" <ks***@mib.orgw rote in message
news:ln******** ****@nuthaus.mi b.org...
>I just tried a small test program that defines an external function called "open". It worked with no problem. The systems I tried it on also have a system function called "open";
Your test is inadequate because you wouldn't see the
problem unless you did an fopen() and suddenly your
code got executed by the C library.
Ok, I just tried that, and it worked fine, to my complete lack of
surprise. fopen() opened the file correctly, and strace shows calls
to the system's open() function; the program also called my own open()
function.
You didn't really expect a major implementation to get this wrong, did
you?
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Paul Edwards wrote:
"Tor Rustad" <to********@hot mail.comwrote in message
<snip>
On Linux you go from user space to kernel space via interrupt
0x80, using inline assembler... ref. <asm/unistd.hand
_syscallN() macros... right?
Well I didn't know that until you told me just now.
Any other way will cause your CRT to be dependant on another library in
the system, not the way I think that you want it.
On Win32 you load kernel32.dll and call the functions via
functions pointers... right?
Well, not the way I'm doing it. I'm using the published
interface, which means I have coded CreateFile() in my
implementation of fopen(), which means I am polluting
the namespace.
By 'coded' you do mean calling CreateFile() defined in kernel32.dll,
don't you. If so that won't pollute the namespace more than other C
libraries will do.
So exactly how do the linker see any function names which
is invading the user name space?
What am I missing???
You're missing the fact that I thought it was a good idea to
use the OS's published interface, at least for Win32 and
OS/2.
That's how it ought to be done. You're not polluting the namespace, the
OS is, and that's a restriction we've got to live with.
And
now I am looking into Unix and wondering what I should
use as the "official interface".
The system call interface exported by the kernel. For the case of Linux
under x86, it's through INT 0x80. Consult the kernel's source and
documentation for details. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JW |
last post by:
Hi,
I don't seem to get any results from the following use
of Runtime.getRuntime().exec(cmd) using Java 1.4 on
Redhat linux.
Suppose that in the same directory as my java file below,
I have files junk1, junk2, junk3, and i want
to have the java program delete all of these files.
|
by: K.S.Liang |
last post by:
Hi all,
1> If there are more than one dynamic linking libraries in the file
system, how do I know which one is loaded into system? Any C library
or system call can tell me which *.so or *.sl is active? Can the
setting of LD_LIBRARY_PATH guanrantee that the correct one is
executed?
2> In MS-WINDOWS, once a DLL is loaded by one allication, this DLL
will be used by the subsequent appication. Does UNIX have the same
|
by: markus |
last post by:
Hi,
I have a question that deals with the standard c library VS (Unix)
system calls.
The question is: which header files (and functions) are part of the C
library and which header files (and function calls) are part of the
(Unix) system calls.
The cause of my confusion is that for example stdio.h is considered
|
by: marek |
last post by:
Dear colleagues,
for one project, I need to link Turbo (or Borland) Pascal with (Turbo)
C code. I would strongly like to avoid rewriting (my) C routines to
Pascal (other part of project is under Unix [yes, I know about gpc and
fpc...), and my clients are medicine doctors, who reject to program in
other lang. than Pascal.
Linking of Turbo C 2 and TP 5.5 from Borland's "Antique software"
works, but there is a well-known problem with...
|
by: ritesh |
last post by:
Hi,
I have been reading some text on C and C++ (i.e advanced books). One
of the books mentioned that C++ requires a runtime support whereas C
does not - what the author was trying to say was that once you compile
a C program the executable created is all that is needed whereas if you
compile a C++ program the executable created requires a C++ runtime
installed on your system to run the program.
Can someone please provide more...
| |
by: lovecreatesbeauty |
last post by:
In the C programming language, I/O operation functions are declared in
stdio.h, for example, fopen(), fclose(), fwrite(), fread(), fseek() ...
But another set of I/O functions are also defined in Unix, for example,
open(), close(), read(), write(), lseek() ...
Which set of functions is more suitable for I/O task, C library version
or Unix version?
Thank you
|
by: John Friedland |
last post by:
My problem: I need to call (from C code) an arbitrary C library
function, but I don't know until runtime what the function name is,
how many parameters are required, and what the parameters are. I can
use dlopen/whatever to convert the function name into a pointer to
that function, but actually calling it, with the right number of
parameters, isn't easy.
As far as I can see, there are only two solutions:
1) This one is portable. If...
|
by: sealo |
last post by:
Hello,
How does the C# App search the library in the runtime?
Say, I build a C# App A, which use B.dll, and B.dll use the C.dll.
I specify the B.dll and C.dll path in the IDE, and build was passed.
If I run the app, do I need to put the B.dll and C.dll in the same
directory with the App?
How does the app search the library which he need?
Or, is there some environment variable of Library Path in .NET, like
"LD_LIBRARY_PATH" in UNIX?
|
by: J de Boyne Pollard |
last post by:
MThe library functions which are included to allow process
Mlaunch, forking, and termination, imply that it is both
Mpossible and desirable for a process to fork itself. This is
Ma fundamental part of the Unix thought process, but is
Mnot essential for a working OS.
There are no Standard C Library functions for process forking or
overlaying. The fork() and execve() functions are part of the C
language bindings to POSIX. They are not...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |