Subject: ld exception c0000005
From: [email-masked] (Kimball Thurston)

12 Aug 1997 11:58:04 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 4.01 [en] (WinNT; I)
Original-To: [email-masked]
X-Priority: 3 (Normal)
Original-Sender: [email-masked]

Hey all,

   If I compile the attached piece of code, call it foo.c, and I am
trying to make a relocatable dll out of it using the following commands
within a batch file, I get a c0000005 exception every time it tries to
do the second ld... any help would be appreciated....

Thanks,
Kimball
-----------------------commands (foo.bat)---------------------

gcc -O2 -c -o foo.o foo.c

echo EXPORTS > foo.def
nm foo.o | grep "^........ T _" | sed "s/^........ T _//" >> foo.def

ld --base-file __fooTemp.base --dll -o foo.so foo.o -e _dll_entry@12
dlltool --as=as --dllname foo.so --def foo.def --base-file
__fooTemp.base --output-exp __fooTemp.exp
REM CRASHES AFTER HERE
ld --base-file __fooTemp.base __fooTemp.exp --dll -o foo.so foo.o -lgcc
-lcygwin -lkernel32 -e _dll_entry@12
dlltool --as=as --dllname foo.so --def foo.def --base-file
__fooTemp.base --output-exp __fooTemp.exp
ld __fooTemp.exp --dll -o foo.so foo.o -e _dll_entry@12

-----------------------exception message-------------------

(ld.exe 1000) In cygwin_except_handler
(ld.exe 1000) Exception trapped!
(ld.exe 1000) exception C0000005 at 42D792
(ld.exe 1000) exception: ax 0 bx 2ECA068 cx 2ECAC9C dx 28
(ld.exe 1000) exception: si 4000 di FFFFFE00 bp 244EEB0 sp 244EEA0
(ld.exe 1000) exception is: STATUS_ACCESS_VIOLATION
(ld.exe 1000) Stack trace:
(ld.exe 1000) frame 0: sp = 0x244ECD4, pc = 0x1000CEC2
(ld.exe 1000) frame 1: sp = 0x244ECF0, pc = 0x77F94512
(ld.exe 1000) frame 2: sp = 0x244ED14, pc = 0x77F88EEB
(ld.exe 1000) frame 3: sp = 0x244EDA0, pc = 0x77F76266
(ld.exe 1000) frame 4: sp = 0x244EEB0, pc = 0x42D895
(ld.exe 1000) frame 5: sp = 0x244EF04, pc = 0x43094E
(ld.exe 1000) frame 6: sp = 0x244F31C, pc = 0x41FA39
(ld.exe 1000) frame 7: sp = 0x244F374, pc = 0x416DCF
(ld.exe 1000) frame 8: sp = 0x244F3A4, pc = 0x1000C102
(ld.exe 1000) frame 9: sp = 0x244FF94, pc = 0x1000C113
(ld.exe 1000) frame 10: sp = 0x244FFA0, pc = 0x4408A9
(ld.exe 1000) frame 11: sp = 0x244FFB0, pc = 0x40103B
(ld.exe 1000) frame 12: sp = 0x244FFC0, pc = 0x77F1B304
(ld.exe 1000) frame 13: sp = 0x244FFF0, pc = 0x0
(ld.exe 1000) End of stack trace

------------------------begin code--------------------------
#define INT8_WEIGHTR 85
#define INT8_WEIGHTG 85
#define INT8_WEIGHTB 85
#define INT16_WEIGHTR 21845
#define INT16_WEIGHTG 21845
#define INT16_WEIGHTB 21845
#define FLT_WEIGHTR 0.333333
#define FLT_WEIGHTG 0.333333
#define FLT_WEIGHTB 0.333333
#define Uint8_WHITE     255
#define Uint16_WHITE   65535
#define UINT8_BITS        8
#define UINT16_BITS      16
#define UINT8_POINT_FIVE   0x80
#define UINT16_POINT_FIVE 0x8000
#define Float32_WHITE       1.0F
#define ALPHAMULT8(v, a, b)\
{\
 Uint16 i = (Uint16)(a) * (Uint16)(b) + UINT8_POINT_FIVE;\
 (v) = (i + (i>>UINT8_BITS)) >> UINT8_BITS;\
}
#define ALPHAMULT16(v, a, b)\
{\
 Uint32 i = (Uint32)(a) * (Uint32)(b) +  UINT16_POINT_FIVE;\
 (v) = (i + (i>>UINT16_BITS)) >> UINT16_BITS;\
}
#define Uint8_LUM(v, r, g, b)\
{\
 Uint8 rs, gs, bs;\
 ALPHAMULT8(rs, (r), INT8_WEIGHTR);\
 ALPHAMULT8(gs, (g), INT8_WEIGHTG);\
 ALPHAMULT8(bs, (b), INT8_WEIGHTB);\
 v = rs + gs + bs;\
}
#define Uint16_LUM(v, r, g, b)\
{\
 Uint16 rs, gs, bs;\
 ALPHAMULT16(rs, (r), INT16_WEIGHTR);\
 ALPHAMULT16(gs, (g), INT16_WEIGHTG);\
 ALPHAMULT16(bs, (b), INT16_WEIGHTB);\
 v = rs + gs + bs;\
}
#define Float32_LUM(v, r, g, b) v = (((r) * FLT_WEIGHTR) +\
           ((g) * FLT_WEIGHTG) +\
           ((b) * FLT_WEIGHTB))
typedef signed  int Int;
typedef signed  char Int8;
typedef signed  short Int16;
typedef signed  int Int32;
typedef signed  long Int64;
typedef unsigned int Uint;
typedef unsigned char Uint8;
typedef unsigned short Uint16;
typedef unsigned int Uint32;
typedef unsigned long Uint64;
typedef float   Float;
typedef float   Float32;
typedef double   Float64;
void computeUint8_E7A160(const Uint8 *ptrA, const Uint8 *ptrB, Uint8
*ptrR,Uint aChan, Uint bChan, Uint count)
{
 Uint8 *endR = ptrR + count;
 while( ptrR < endR )
 {
  *ptrR++ = ptrA[0];
  *ptrR++ = ptrA[1];
  *ptrR++ = ptrA[2];
  *ptrR++ = Uint8_WHITE;
 ptrA += aChan;
 ptrB += bChan;
 }
}
void computeInUint8_E7A160(const Uint8 *ptrA, const Uint8 *ptrB, Uint8
*ptrR, Uint8 *ptrT,Uint aChan, Uint bChan, Uint count)
{
 Uint8 *endR = ptrR + count;
 while( ptrR < endR )
 {
  Uint8 *ptrTR;
  ptrTR = ptrT;
  *ptrTR++ = ptrA[0];
  *ptrTR++ = ptrA[1];
  *ptrTR++ = ptrA[2];
  *ptrTR++ = Uint8_WHITE;
  ptrTR = ptrT;
  *ptrR++ = *ptrTR++;
  *ptrR++ = *ptrTR++;
  *ptrR++ = *ptrTR++;
  *ptrR++ = *ptrTR++;
 ptrA += aChan;
 ptrB += bChan;
 }
}
void computeUint16_E7A160(const Uint16 *ptrA, const Uint16 *ptrB, Uint16
*ptrR,Uint aChan, Uint bChan, Uint count)
{
 Uint16 *endR = ptrR + count;
 while( ptrR < endR )
 {
  *ptrR++ = ptrA[0];
  *ptrR++ = ptrA[1];
  *ptrR++ = ptrA[2];
  *ptrR++ = Uint16_WHITE;
 ptrA += aChan;
 ptrB += bChan;
 }
}
void computeInUint16_E7A160(const Uint16 *ptrA, const Uint16 *ptrB,
Uint16 *ptrR, Uint16 *ptrT,Uint aChan, Uint bChan, Uint count)
{
 Uint16 *endR = ptrR + count;
 while( ptrR < endR )
 {
  Uint16 *ptrTR;
  ptrTR = ptrT;
  *ptrTR++ = ptrA[0];
  *ptrTR++ = ptrA[1];
  *ptrTR++ = ptrA[2];
  *ptrTR++ = Uint16_WHITE;
  ptrTR = ptrT;
  *ptrR++ = *ptrTR++;
  *ptrR++ = *ptrTR++;
  *ptrR++ = *ptrTR++;
  *ptrR++ = *ptrTR++;
 ptrA += aChan;
 ptrB += bChan;
 }
}
void computeFloat32_E7A160(const Float32 *ptrA, const Float32 *ptrB,
Float32 *ptrR,Uint aChan, Uint bChan, Uint count)
{
 Float32 *endR = ptrR + count;
 while( ptrR < endR )
 {
  *ptrR++ = ptrA[0];
  *ptrR++ = ptrA[1];
  *ptrR++ = ptrA[2];
  *ptrR++ = Float32_WHITE;
 ptrA += aChan;
 ptrB += bChan;
 }
}
void computeInFloat32_E7A160(const Float32 *ptrA, const Float32 *ptrB,
Float32 *ptrR, Float32 *ptrT,Uint aChan, Uint bChan, Uint count)
{
 Float32 *endR = ptrR + count;
 while( ptrR < endR )
 {
  Float32 *ptrTR;
  ptrTR = ptrT;
  *ptrTR++ = ptrA[0];
  *ptrTR++ = ptrA[1];
  *ptrTR++ = ptrA[2];
  *ptrTR++ = Float32_WHITE;
  ptrTR = ptrT;
  *ptrR++ = *ptrTR++;
  *ptrR++ = *ptrTR++;
  *ptrR++ = *ptrTR++;
  *ptrR++ = *ptrTR++;
 ptrA += aChan;
 ptrB += bChan;
 }
}

extern int __stdcall dll_entry (void * h, unsigned long reason, void
*ptr);

int __stdcall dll_entry (void *h, unsigned long reason, void *ptr)
{
h; reason; ptr;
switch (reason)
{
case 1:
break;
case 2:
break;
case 3:
break;
case 0:
break;
}
return 1;

}
asm(".section .idata$3\n" ".long 0,0,0,0,0");

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".