|
|
Shared Library, common function
Hello,
I have created a shared library, so any tool within project shared most
commonly used functions.
One of the functions looks like this:
FILE *db_fifo() {
FILE *fifo;
fifo = fopen("/somewhere/db","w");
if (fifo)
return fifo;
return NULL;
}
unfortunately after the function returns, nobody is able to use the fifo,
because it is invalid.
Is it possible to use a shared libarary and return usable resources like a
pointer to FILE?
P.Krumins
|
|
0
|
|
|
|
Reply
|
Peteris
|
7/1/2003 7:14:48 PM |
|
In article <Xns93ABE22592A41whitesuneapollolv@130.133.1.4>,
Peteris Krumins <pkruminsREMOVETHIS@inbox.lv> wrote:
>Hello,
>
> I have created a shared library, so any tool within project shared most
>commonly used functions.
>
> One of the functions looks like this:
>
>FILE *db_fifo() {
> FILE *fifo;
>
> fifo = fopen("/somewhere/db","w");
> if (fifo)
> return fifo;
>
> return NULL;
>}
>
> unfortunately after the function returns, nobody is able to use the fifo,
>because it is invalid.
>
> Is it possible to use a shared libarary and return usable resources like a
>pointer to FILE?
Of course it is. fopen() is also in a shared library, and it returns a
pointer to FILE that's usable.
There must be something else wrong with your code.
--
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
|
|
0
|
|
|
|
Reply
|
Barry
|
7/1/2003 8:27:48 PM
|
|
Peteris Krumins wrote:
>
> Is it possible to use a shared libarary and return usable resources like a
> pointer to FILE?
Sure. What system are you using? If you are in a pseudo-UNIX
environment (i.e. cygwin, u/win...) under ms-windows this can be a big
issue.
-- ced
--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
|
|
0
|
|
|
|
Reply
|
Chuck
|
7/3/2003 2:30:00 PM
|
|
Chuck Dillon <cdillon@nimblegen.com> wrote in
news:3F043DE8.9030204@nimblegen.com:
> Peteris Krumins wrote:
>>
>> Is it possible to use a shared libarary and return usable resources
>> like a
>> pointer to FILE?
>
> Sure. What system are you using? If you are in a pseudo-UNIX
> environment (i.e. cygwin, u/win...) under ms-windows this can be a big
> issue.
Thanks for the comment, i have already solved the problem, as my function
the library was more compicated than i posted, i didnt notice a small bug
which affected the pointer to be returned.
And, i am not programming in a pseudo-unix env.
P.Krumins
|
|
0
|
|
|
|
Reply
|
Peteris
|
7/5/2003 8:05:49 PM
|
|
|
3 Replies
208 Views
(page loaded in 0.057 seconds)
Similiar Articles: Error building C shared lib on Linux - comp.soft-sys.matlab ...Cannot step inside shared object in Solaris 10 - comp.unix ... Shared Library, common function - comp.unix ... linux shared memory synchronization objects ... shared ... embed resources in shared lib? - comp.unix.programmerShared Library, common function - comp.unix.programmer Hello, I have created a shared library, so ... libarary and return usable resources like a >pointer to FILE? How to implement a function to copy file on LINUX ? - comp.unix ...FIFO file objects - comp.unix.programmer I am trying to implement your ... Shared Library, common function - comp.unix.programmer FILE *db ... map pages of memory - Linux ... unicast and broadcast on same socket - comp.unix.programmer ...fork function - comp.unix.programmer unicast and broadcast on same socket - comp.unix.programmer ... Shared Library, common function - comp.unix.programmer unicast and ... templates + RTTI + shared library = impossible? - comp.lang.c++ ...He solved it by creating a static function in the shared library that defines the derived ... static ... that is to link both extension modules to a common shared library ... Linker Can't Find Library - comp.os.ms-windows.programmer.win32 ...> > > =A0 Each executable relies on static libraries of code common ... Most link problems I had were shared libraries with ... Linux assembly using C library functions - comp.unix ... Calling dll from Matlab - comp.soft-sys.matlabHi all, I have a question regarding calling shared libraries for windows from ... The MATLAB environment does not allow for easy access to common Windows functions; this ... f77 and dynamic arrays in common blocks - comp.lang.fortran ...... the subroutine or functions, but in the subroutine or function ... Using thread-specific data in shared libraries - comp.programming ... One common way is to have a 'thread ... Practice of using fork() - comp.unix.programmerYou can't call functions like 'getpwuid' after you 'fork'. > The common wisdom of ... file descriptors (which share a common file pointer), or with closing a library ... Linux dynamic library and static C++ data - comp.os.linux.misc ...... shared DLL, then its reasonable that that library can maintain common variables to both. The need for shared ... Linux assembly using C library functions - comp.unix ... Function Libraries | ASP.NET 101But, when it comes to common functions, referencing a Function Library on ... MySQL as String Public Shared objDR as SqlDataReader. Now, since this a common function ... Shared LibrariesShared Libraries. Shared libraries are libraries that are ... usr/local/lib to /etc/ld.so.conf is a common ... environment variable LD_PRELOAD lists shared libraries with functions ... 7/9/2012 8:15:05 AM
|
|
|
|
|
|
|
|
|