Help with Windows DLL linking

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

 



GCC Help,
I am trying to help some developers that are using GCC to develop a linux application that will run on windows. They would like to link into several functions in a dll that I provide under windows that provides serial communication in windows.

My build tools for the windows dll is Microsoft C/C++ version 6 Visual Studio. I create with the Microsoft tools the windows DLL, and LIB file for linking windows C programs. I obviously also have Microsoft compliant .def files for the dll and header files. The dll that is created using the Microsoft tools is linked with the following lib files in its construction: kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib.

Now I need to link a simple little .c program to the dll using the gcc tools.

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.

2nd approach: create a def file using the gcc tools by..
Echo EXPORTS > foo.def
nm foo.dll | grep ' T _' | sed 's/.* T _//' >> foo.def

This simply tells me that foo.dll has no symbols, even if I use the Microsoft debug version of the dll.

3rd approach: compile the dll using gcc. Unfortunately there is the issue of all of the lib files that the dll needs to link with and I have a circular problem.

How can I approach this successfully?

Robert Hansen  Crystal Software
crystalcom@xxxxxxxxxxxx
crystalcom@xxxxxxxxxx
crystalrh@xxxxxxxxxxx
crystal@xxxxxx
329 Fire Lake Road
Crystal Falls, MI 49920
(906) 822-7994
(906) 250-5031 Cell





[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