Hello everybody,

I have been trying to learn the basis of shared libraris and when I almost
beleived that I have made it I found a heck of a mistake.

Lets take my problem to the sample lib project from 3com or even to the
sample lib project from Jeff Ishaq, the fellow who wrote a great article
about shared libraries. Both projects compiled good. Without any error. Even
they work fine.

Now I add a two sipmle lines to any function in my shared library (I did
this for testing, couse it was hard to find the exact reason of my problem)

For example, I will use the sample lib project code:

Err SampleLibDrawRectangle(UInt refNum, DWord clientContext, Int x, Int y,
Int width, Int height) {
 Err      err = 0;
 Int      cornerDiam;   // corner diameter
 RectangleType   r;      // rectangle

==>     unsigned long   a,b,c;            // Added by me

==>      a = b / c;                            /// Added by me
( ...........)
Here goes the rest of the code, but thats not important.
( ...........)
 return( 0 );
}

Those (the unsigned long declaration and the division) was the only lines I
added to a project that compiled quite fine. When I recompiled it i get the
followin error

Link Error   : SampleLib.c: '__ldivu__' referenced from
'SampleLibDrawRectangle' is undefined.

Please, if anybody has any idea of this I would apreciate it a lot.

What I realized or guess is that the compiler is calling a dividing function
due to the / opperand and some how, who knows why, the compiler coudn't
found the fucntion. I went around with some linker options but without any
success.

NOTE: It is also not working with * (multiplication)

Ariel
Buenos Aires, Argentina, SouthAmerica.

Reply via email to