_init() and _fini() for dynamically loaded libraries?

2003-03-19 Thread Daniel Daboul
Does Cygwin support initialization and cleanup for libraries loaded
dynamically via dlopen() in a way similar to Linux and Solaris?  If
yes, how can I get it to work?  I attached a simple test case below,
with comments telling how to compile/link.  The output under cygwin
is:

calculating
doubled in library: 2.468000

So it basically works, but neither _init() nor _fini() get
executed. Under Solaris the output is:

initializing
calculating
doubled in library: 2.468000
finishing

(There I link with "ld -Bshareable mylib.o -o libmylib.dll" and "gcc
-Wall -o caller caller.c -ldl".)  Solaris declares _init and _fini in
 (actually returning int), which does not exists in my
cygwin installation, but I'm not sure this is enough to conclude that
it's unsupported.  I didn't find help in the documentation or
mail-archives. -- Daniel

/* mylib.c
   gcc -Wall -c mylib.c
   gcc -shared -Wl,--export-all mylib.o -o libmylib.dll
*/
#include 
double dub(double in1) {printf("calculating\n");return 2*in1;}
void _init() {printf("initializing\n");}
void _fini() {printf("finishing\n");}

/* caller.c
   gcc -Wall -o caller caller.c
   ./caller
*/
#include 
#include 
#include 
int main() {
void *handle;
double (*pdub)(double);
char *error;
handle = dlopen("./libmylib.dll",RTLD_LAZY);
if(!handle) {fprintf(stderr,"%s\n",dlerror()); exit(1);}
pdub =dlsym(handle,"dub");
if((error = dlerror())!=NULL) {fprintf(stderr,"%s\n",error); exit(1);}
printf("doubled in library: %f\n",(*pdub)(1.234));
dlclose(handle);
return 0;
}

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Updated: emacs-24.5-3 (TEST)

2016-01-29 Thread Daniel Daboul
On Sun, Jan 24, 2016 at 1:30 AM, Ken Brown  wrote:
> The following packages have been updated in the Cygwin distribution as
> test releases:
>
> * emacs-24.5-3
> * emacs-X11-24.5-3
> * emacs-w32-24.5-3
> * emacs-el-24.5-3
> [...]
> This is a rebuild of the 24.5-2 packages, patched to allow native Windows
> paths like C:\foo or C:/foo in situations where file names are expected.
>
> If you are interested in this feature, please try the test release and let
> me know whether it works the way you expect.

Thank you for the packages. I have started to use "emacs-w32-24.5-3",
I like the new
features and I have not encountered obvious bugs.

A shortcoming of the new version "GNU Emacs 24.5.1 (i686-pc-cygwin) of
2016-01-23 on moufang"
compared to a mingw version "GNU Emacs 24.3.1 (i386-mingw-nt6.2.9200)
of 2013-03-17 on MARVIN",
which I also use, is that file-name completion does not work for find-file if
a windows-style directory path is used. - Daniel

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: Updated: emacs-24.5-3 (TEST)

2016-02-03 Thread Daniel Daboul
Ken Brown  cornell.edu> writes:
> Actually, completion seems to work for me if I use forward slashes but 
> not if I use backslashes.  Can you confirm that?  If not, please show me 
> a case where it fails.

Yes, you are right.

c:/Program Fil[tab]

is actually completed. I didn't notice that because
I tried backslashes. I think that's good enough for me,
although the mingw version I mentioned handles either.


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple