[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: shared library entry point



As the well known Moya Piernavieja Rodrigo said...
->Hi all!
->
->sorry if this is off-topic!!
	[it is... but you look so good :)]

->
->I have been looking for some documentation on initialization 
->functions in shared libraries, such as Win32's DLLMain function, 
->but have not found anything about it on my solaris box. Does 
->this concept exist? if not, how can I force a function to be 
->called every time a process loads the library?

	I don't think this concept exists on Unix systems.
	Actually it is not needed at all - and this reveals
	a major Windows design problem : a library is not
	an executable file. A library is a library. Nothing
	more.

	Actually, to do what you want, you'll probably have
	to load the libary with dlopen() and provide your
	own interface to the library - just a small wrapper,
	something like

	void *
	my_dlopen(path,mode)
	const char *path;
	int mode;
	{
		void		*hmodule;
		my_init_func_t  func;

		hmodule = dlopen(path,mode);
		func = (my_init_func_t)dlsym(hmodule,"my_init_func");
		func(params);
		return (hmodule);
	}
	
	[of course, you must check return codes]
		
	Hope this helps, regards.

->
->Thanks very much
->
->
->-- 
->         To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
->                       "unsubscribe" as the Subject.
->
->	Mailing list concerns should be mailed to <listmaster@redhat.com>
->


-- 
__________________________________________________________________________
   Emmanuel DELOGET [pixel] pixel@{dotcom.fr,epita.fr}  ----  DotCom SA
         http://www.epita.fr/~pixel | http://www.dotcom.fr/~pixel
"On the last day, God created Linux. And Microsoft won its antitrust case"
--------------------------------------------------------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]