Re: Help with Windows DLL linking

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

 



----- Original Message ----- 
From: "Robert Hansen Crystal Software"
.
.
>
> 1st approach: use the def file that I already have using the tool to
create
> a .a file to link to my compiled c program
> The command "dlltool -def foo.def -dllname fll.dll -output-lib foo.a"
> appears to work, but when I try to use the command
> "gcc -o myprog myprog.c -L./ -lfoo" I get an error for each one of the
> functions that the program calls in the foo dll that states that they are
> undefined.
>

I'm no expert on this - which is why I've held off replying, hoping that
someone with more expertise would step up.

A recent MinGW (native Win32) port of gcc should be able to link to the
'.lib' file. (I think "recent" means gcc version 3.0.0 or later - though
perhaps some of the earlier versions are also ok in this regard.)

So - for that gcc command to work you shouldn't have to do anything, except
place foo.lib in the current directory, and place foo.dll somewhere in the
path (but not in the current directory - or it might get found instead of
foo.lib).

Visual Studio can't link directly to dll's, but gcc generally can. However,
for that to work, the dll might have to have been *built* using gcc.

If the gcc that you're using is not the MinGW port, then maybe that's an
issue (dunno). Otherwise, I can only think that foo.lib has not been found.

Because MinGW's gcc can link to '.lib' files, the option you mentioned later
on of building the dll using gcc should also work - at least it shouldn't
fail for the reason you cited :-)

Cheers,
Rob


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux