This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

arm-wince-pe: creates unusable DLL


Hello crossgcc:

First of all, thanks (especially to Kai!!) for the assistance.
I appear to be getting a lot closer to creating a working
DLL on arm-wince-pe, but I'm still not quite there.

As suggested by Kai, I'm creating a DLL using the prescription given
in part 10 of the "README-interworking" document that comes with the
GCC sources.  My DLL creation script is the following:

#!/bin/sh

export BINDIR=/usr/local/arm-wince-pe/bin
export DLLTOOL=$BINDIR/dlltool
export CC=$BINDIR/gcc
export LD=$BINDIR/ld
export LIBDIR=/home/craigv/rainergcc/baselibs/arm

$CC -v -s -g -c testdll.c
$CC -v -s -g -fno-leading-underscore -c dllmain.c
$DLLTOOL --verbose --def testdll.def --output-exp dll.o --output-lib dll.a
$LD -M -v testdll.o dllmain.o dll.o -o testdll.dll --dll --subsystem wince:3.00 --entry DllMain -lcoredll >
testdll.map 2>&1

My source files appear thusly:
----------------------------------------
test.c:
#include <windows.h>
typedef int size_t;
#include <stdio.h>

extern void DLL_hello();

int main(int argc, char *argv[])
{

  DLL_hello();

  return(0);
}

----------------------------------------
dllmain.c:
#include <windows.h>
typedef int size_t;
#include <stdio.h>

BOOL WINAPI DllMain(HANDLE hinstDLL, DWORD dwReason, LPVOID foo)
{
  return TRUE;
}

----------------------------------------
testdll.c:
include <windows.h>
typedef int size_t;
#include <stdio.h>

#if defined(UNDER_CE)
__declspec(dllexport)
#endif
void DLL_hello()
{
 FILE *fp;

 fp = fopen("/temp/foo", "wb");

 fprintf(fp, "Hello, ");
 fprintf(fp, "DLL World\n");
 fclose(fp);

}

#if defined(UNDER_CE)
__declspec(dllexport)
#endif
void _DLL_hello() { DLL_hello(); }

-----------------------------------------
testdll.def:
; testdll.def
LIBRARY     testdll
STACKSIZE   0x100000, 0x1000
HEAPSIZE    0x100000, 0x1000
VERSION     6.20
EXPORTS
            _DLL_hello   @1


The script creates a DLL without errors or warnings, but the result is not
functional on wince 3.0.  When I run it on Wince 3.0, I get "Cannot
find test (or one of its components..." in an error dialog.  Apparently
this is because the dynamic loader can't load the DLL.  I compared the
output of "dumpbin /all" for both the GCC-created DLL and one created
(from the same source) with EVC 3.0.  So far, I have not been able to
ascertain much from this comparison and the GCC-created DLL seems to
look okay.

I would really appreciate any suggestions for debugging this.  In
particular, how might I be able to figure out what the wince loader
doesn't like about my DLL's??

Baffled in Boulder, but nearly there (??)
craig vanderborgh
voxware incorporated

Kai Ruottu wrote:
> 
> Craig Vanderborgh <craigv@voxware.com>
> 
> > I am working with an arm-wince-pe build of GCC and binutils
> > (versions 3.2 and 2.13 respectively) and I have been able
> > to successfully create .exe files on X86 linux that run on my
> > ARM/wince target (an ipaq 3760).  Many thanks to all who've
> > helped me get this far!!
> >
> > I am now to the point where I need to create DLL's for my
> > ARM/wince target.  Could someone please, if possible, show
> > a small example of how to do this for the simplest case.  I need
> > to know what the command line should look like, and what
> > pitfalls may exist.
> 
>  After someone asked about producing DLLs with 'arm-elf', I
> remembered somewhere being instructions for creating DLLs
> with ARM... The 'gcc/config/arm/README-interworking' in the
> GCC-sources seemed to be that. The part '10.', "How to use
> dlltool to build ARM/Thumb DLLs" in this document should
> teach something about this.
> 
>  Generally the GCC-manual would need fixing with the dllimport
> and dllexport issue, these are documented to be supported with
> the Cygwin-version for WinNT/PowerPC only, but the BeOS/i386
> (ELF-format), ARM/pe, MCORE/pe, MIPS/pe, SH/pe and of course
> the Cygwin/Mingw/pe on i386 should support these attributes
> too... Someone recently works with porting Mingw to WinNT/Alpha
> and also this unofficial 'PE'-port should have this support.
> But unfortunately not the 'arm-elf' target.
> 
> Cheers, Kai

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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