Problem with Miracl Library (Shamus Softwares)

Started by KKR_WE_RULE, January 19, 2011, 07:17:47 AM

Previous topic - Next topic

KKR_WE_RULE

Well, to be frank, I am a newbie with C/C++.
I was trying to use the BigNum Library by Shamus named MIRACL with Pelles C.

But I cant get it to work.

I've included the miracl.h & mirdef.h, but

miracl *mip = mirsys(128, 16) --> gives "POLINK: error: Unresolved external symbol '_mirsys@8'." as error.

Can some 1 help me with this ?

Best Regards
KKR

AlexN

Quote from: KKR_WE_RULE on January 19, 2011, 07:17:47 AM
I've included the miracl.h & mirdef.h, but

miracl *mip = mirsys(128, 16) --> gives "POLINK: error: Unresolved external symbol '_mirsys@8'." as error.

You added the include files for the compiler, but you must also add the library for the linker. you can do this in the IDE or in the source with #pragma lib "<libraryname>".
best regards
Alex ;)

KKR_WE_RULE

#include "miracl.h"
#include "mirdef.h"

#pragma lib <miracl.lib>

This is what I did.

The error continues to show.

I've attached the project.. It a demo so called keygenme, to get used to the working of miracl.




TimoVJL

#pragma lib "miracl.lib"
or
#pragma comment(lib, "miracl.lib")
May the source be with you

KKR_WE_RULE

I tried both of them.
But same problem remains.

Miracl library is very important to me.. but I cant get it to work :(

Plz hlp guys .

frankie

If you have compiled the library on yourself be sure to have compiled it with the same calling convention of your code.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Stefan Pendl

#pragma lib <miracl.lib>
This assumes your library is located in the library search path defined for the project.

#pragma lib "miracl.lib"
// or
#pragma comment(lib, "miracl.lib")

These assume your library is in the folder, where your source code is located.

Did you change the include and library search path of the project to include the path to both files?
---
Stefan

Proud member of the UltraDefrag Development Team

KKR_WE_RULE

my files (miracl.h) & (mirdef.h) & (miracl.lib) are located in the same dir as the src .

I noticed something.

When I compile the code, it is perfect, but when I try to build it, its then that the IDE starts complaining :(

Any specific way to compile the Miracl library for pelles C ?

I have never used any third party lib in C/C++ & new to C.

Thanx for all your efforts guys :)

Best Regards
KKR

Stefan Pendl

The compiler only needs the header files, so this part is working correctly.

The linker needs the library file, so here is the problem.

The library and the resulting program must be of the same bit type:

  • 32-bit program needs 32-bit library
  • 64-bit program needs 64-bit library

You can not mix that.
---
Stefan

Proud member of the UltraDefrag Development Team

KKR_WE_RULE

Right.. but my miracl library is a 32 bit library.

www.shamus.ie

It can be found in the above website.

Its a library built with C :)

So any suggestions on how to fix this mess :D

Thx for the quick reply man :)

Best Regards
KKR

TimoVJL

miracl.lib uses msvc libc.lib and is cdecl-lib.
Test this modified project.
May the source be with you

KKR_WE_RULE

Woah!!!! You are the man!!!
Perfect :)

Would you please explain what was wrong ?
That would help me learn & get a proper conception of it :)

Best Regards
KKR

TimoVJL

That miracl.lib is static library for msvc and uses cdecl calling conventions and default library is LIBC.lib (msvc).
Header files doesn't define calling convention so cdecl is expected.
That's why example uses cdecl calling convention and msvcrt.lib.
May the source be with you

KKR_WE_RULE

I see.
Thanx very much for support guys :)

I am extremely pleased :)

Best Regards
KKR

KKR_WE_RULE

#14
Hey guys.. Again :

POLINK: error: Unresolved external symbol '__allmul'.
POLINK: error: Unresolved external symbol '__aulldiv'.
POLINK: fatal error: 2 unresolved external(s).

The line thats causing it is :
ecurve_init(a, b, p, MR_PROJECTIVE);

What do I need to do to solve it ?

Regards
KKR

*edit*

I've attached the project, in case you need to see the source :)