Hi, Well, I need to create a Windows version of the library I previously created on the Mac. I've installed MingW32 and MYSYS on my PC. GPC automakes my Pascal source files and creates .o and .gpi files. And at this point I'm completely at sea.
I need to create a DLL which is loadable from a Visual Studio C++ application.
By analogy with the gcc command given in the MingW32 FAQ (http:// www.mingw.org/mingwfaq.shtml), I tried:
$ gpc -c --automake MySource.p -shared -o MySource.DLL -Wl, --ouput- def, MySource.def, --out-implib, MySource.a -lgpc
and the output is:
gpc.exe: --output-def: linker input file unused because linking not done gpc.exe: MySource.def: linker input file unused because linking not done gpc.exe: --out-implib: linker input file unused because linking not done gpc.exe: MySource.a: linker input file unused because linking not done gpc.exe: -lgpc: linker input file unused because linking not done
And even if this had worked, I'm not quite sure what the next step would have been, so it'd be nice if I could get all the voodoo and not just the next step.
I could use, and appreciate some hand holding here.
$gpc --version gpc.exe 20051116, based on gcc-3.2.3 (mingw special 20030504-1)
$ gcc --version gcc.exe (GCC) 3.2.3 (mingw special 20030504-1)
--glenn
Glenn Howes wrote:
I need to create a DLL which is loadable from a Visual Studio C++ application.
By analogy with the gcc command given in the MingW32 FAQ (http:// www.mingw.org/mingwfaq.shtml), I tried:
$ gpc -c --automake MySource.p -shared -o MySource.DLL -Wl, --ouput- def, MySource.def, --out-implib, MySource.a -lgpc
and the output is:
gpc.exe: --output-def: linker input file unused because linking not done gpc.exe: MySource.def: linker input file unused because linking not done gpc.exe: --out-implib: linker input file unused because linking not done gpc.exe: MySource.a: linker input file unused because linking not done
There must be no space after the commas after the "-Wl" options:
[...] -Wl,--output-def,MySource.def,--out-implib,MySource.a -lgpc
gpc.exe: -lgpc: linker input file unused because linking not done
The "-Wl" options are used only for linking, and "-c" tells GPC not to link. I don't know the full procedure (I don't use Windows), but perhaps just omit the "-c", or move the "-Wl" options to a later command (if there's one).
Frank
Franks, thanks for taking my question.
I omitted the -c as suggested and now I'm getting a huge stream warnings about undefined references: $ gpc --automake MySource.p
gives dozens of warnings like:
C:/DOCUME~1/ghowes/LOCALS~1/Temp/ccEpaaaa.o(.text+0x92) : MySource.p : undefined reference to `_p__m8_MySource3_S27_Callpropertiesnull'
these are all methods in the .p files which are gathered together by the automake. I hadn't seen these undefined references on the Mac, but I'd been using the Mac libtool utility to gather together the .o files after the compile and generating a static library, not a DLL.
The .def file is created, as is the MySource.a file, but it seems to small as to have the libgpc linked into it (on my install libgpc.a is 278KB) while MySource.a is 354KB).
The .def file looks like this: EXPORTS Counter @1 DATA MyFunction @2 GPC_init @3 ...
So, should I be concerned about the undefined references? And if so, what can I do about it? And, how do I get from a .a file and a .def file to a Windows DLL?
On Jan 7, 2007, at 8:28 PM, Frank Heckenbach wrote:
Glenn Howes wrote:
I need to create a DLL which is loadable from a Visual Studio C++ application.
By analogy with the gcc command given in the MingW32 FAQ (http:// www.mingw.org/mingwfaq.shtml), I tried:
$ gpc -c --automake MySource.p -shared -o MySource.DLL -Wl, --ouput- def, MySource.def, --out-implib, MySource.a -lgpc
and the output is:
gpc.exe: --output-def: linker input file unused because linking not done gpc.exe: MySource.def: linker input file unused because linking not done gpc.exe: --out-implib: linker input file unused because linking not done gpc.exe: MySource.a: linker input file unused because linking not done
There must be no space after the commas after the "-Wl" options:
[...] -Wl,--output-def,MySource.def,--out-implib,MySource.a -lgpc
gpc.exe: -lgpc: linker input file unused because linking not done
The "-Wl" options are used only for linking, and "-c" tells GPC not to link. I don't know the full procedure (I don't use Windows), but perhaps just omit the "-c", or move the "-Wl" options to a later command (if there's one).
Frank
-- Frank Heckenbach, f.heckenbach@fh-soft.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8
On 7 Jan 2007 at 20:59, Glenn Howes wrote:
[...]
And, how do I get from a .a file and a .def file to a Windows DLL?
REM - "a2dll.bat": @echo off dlltool --input-def %1.def --output-exp %1.exp ld --warn-once --enable-auto-image-base --noinhibit-exec -o %1.dll %1.exp %1.a
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/