This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Dynamically load a shared lib created using gcc/Cygwin


Yu-Cheng Chou wrote:

> mylib.dll was created using gcc/cygwin based on some libraries that were
> also built using gcc/cygwin and CANNOT be re-built by other compilers.
> I have to, and need only to load mylib.dll at run-time by function
> LoadLibrary("mylib.dll")
> in an applicaiton that was built by Visual C++ or .NET.
> When I ran this application in Windows XP, it hung at LoadLibrary
> ("mylib.dll").

Please stop sending me personal email.  This is a public mailing list,
address all replies to the list.

I don't see what the different compilers have to do with anything.  You
would be facing the same situation if you tried to load cygwin1.dll from
a mingw program without properly initializing it, and in that case
everything would be built from gcc.  The only reason you don't have to
worry about this for Cygwin .exes is that the initialization code is
done for you in the CRT startup code.

I don't know what to tell you.  The Cygwin DLL has its own special
requirements that have to be met.  If you don't load it properly your
application will not work.  If you can't do that you can't use the DLL.

You might be able to work around this by making a stub DLL with the same
interface as mylib.dll, that would load and initialize cygwin1.dll and
then load the real mylib.dll, and pass through any function calls to
mylib.dll.  But doing that would be a whole lot harder than just having
the program that is doing LoadLibrary("mylib.dll") first load the Cygwin
DLL.  And since all these programs must be open source (or else you're
violating the Cygwin license agreement), I don't see why you can't just
do that.

Brian

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]