# Using a stream function into another module

- Thread: https://externals.io/message/46217
- Original archive: https://news-web.php.net/php.internals/46217
- Started by Samuel ROZE on 2009-11-27T17:53:52+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #46217 — Samuel ROZE — 2009-11-27T17:53:52+00:00

URL: https://externals.io/message/46217#46217

Hello,

I want to use two stream functions (stream_array_to_fd_set and
stream_array_from_fd_set) in a module (/etc/modulename/modulename.c). To
use them, i included the streamsfuncs.h file, with:

#include "ext/standard/streamsfuncs.h"

The problem is that when I want to compile, i've these errors:

/home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:877: undefined reference to `stream_array_to_fd_set'
/home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:884: undefined reference to `stream_array_to_fd_set'
/home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:891: undefined reference to `stream_array_to_fd_set'
/home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:936: undefined reference to `stream_array_emulate_read_fd_set'
/home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:957: undefined reference to `stream_array_from_fd_set'
/home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:958: undefined reference to `stream_array_from_fd_set'
/home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:959: undefined reference to `stream_array_from_fd_set'

How can I do to use them into my module ?

Regards,
Samuel ROZE.

---

## #46241 — Samuel ROZE — 2009-11-29T23:37:28+00:00

URL: https://externals.io/message/46217#46241 · In reply to: #46217

Nobody can help me ? Is there someone who can just give me some astuces ?

Regards,
Samuel ROZE.

2009/11/27 Samuel ROZE <samuel.roze@gmail.com>:
> Hello,
>
> I want to use two stream functions (stream_array_to_fd_set and
> stream_array_from_fd_set) in a module (/etc/modulename/modulename.c). To
> use them, i included the streamsfuncs.h file, with:
>
> #include "ext/standard/streamsfuncs.h"
>
> The problem is that when I want to compile, i've these errors:
>
> /home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:877: undefined reference to `stream_array_to_fd_set'
> /home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:884: undefined reference to `stream_array_to_fd_set'
> /home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:891: undefined reference to `stream_array_to_fd_set'
> /home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:936: undefined reference to `stream_array_emulate_read_fd_set'
> /home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:957: undefined reference to `stream_array_from_fd_set'
> /home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:958: undefined reference to `stream_array_from_fd_set'
> /home/samuel/Développement/workspaces/C-Cpp/PHP_5_3/ext/sockets/sockets.c:959: undefined reference to `stream_array_from_fd_set'
>
> How can I do to use them into my module ?
>
> Regards,
> Samuel ROZE.

---

## #46244 — Jess Portnoy — 2009-11-30T08:50:44+00:00

URL: https://externals.io/message/46217#46244 · In reply to: #46241

Hi,

stream_array_to_fd_set() is defined in ext/standard/streamsfuncs.c, not 
the header.
But I see the actual complaint is on ext/sockets/sockets.c:877: 
undefined reference to `stream_array_to_fd_set'...
What exactly did you do?

May the source be with you,
Best regards,
Jess Portnoy



Samuel ROZE wrote:
> Nobody can help me ? Is there someone who can just give me some astuces ?
>
> Regards,
> Samuel ROZE.
>
> 2009/11/27 Samuel ROZE <samuel.roze@gmail.com>:
>   
> > […]

---

## #46248 — Samuel ROZE — 2009-11-30T13:05:41+00:00

URL: https://externals.io/message/46217#46248 · In reply to: #46244

Thanks for you reply,

These errors are in the ext/sockets/sockets.c file because I tried to
add a function about sockets in this file which is using the
"stream_array_to_fd_set", and others functions...

If I include the ext/standard/streamsfuncs.c file, where functions are
created, I've some errors about the duplication of theses stream
functions.

I think the problem is that the ext/standard/streamsfuncs.c is loaded
after the ext/sockets/socket.c and functions are not initialized yet
when the socket.c is builded... BUT, it's a wrong idea because when I
move my new function into the streamfuncs.c file, there's the same
problem !

Regards,
Samuel ROZE.

2009/11/30 Jess Portnoy <jess@zend.com>:
> Hi,
>
> stream_array_to_fd_set() is defined in ext/standard/streamsfuncs.c, not the
> header.
> But I see the actual complaint is on ext/sockets/sockets.c:877: undefined
> reference to `stream_array_to_fd_set'...
> What exactly did you do?
>
> May the source be with you,
> Best regards,
> Jess Portnoy
>
>
>
> Samuel ROZE wrote:
> > […]

---

## #46258 — johannes@schlueters.de — 2009-12-01T12:16:43+00:00

URL: https://externals.io/message/46217#46258 · In reply to: #46217

> Hello,
> 
> I want to use two stream functions (stream_array_to_fd_set and
> stream_array_from_fd_set) in a module (/etc/modulename/modulename.c). To
> use them, i included the streamsfuncs.h file, with:

stream_array_from_fd_set is declared static in streamsfuncs.c and can't
be used in other places. You either have to find a wrapper around it,
make the streams layer exporting the functions (there mightbe a reason
why they are static - didn't look into it) or find another way to
implement what you need.

johannes
