NO

Author Topic: Problem with Miracl Library (Shamus Softwares)  (Read 17902 times)

KKR_WE_RULE

  • Guest
Problem with Miracl Library (Shamus Softwares)
« on: January 19, 2011, 07:17:47 AM »
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

Offline AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #1 on: January 19, 2011, 07:47:26 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

  • Guest
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #2 on: January 19, 2011, 08:41:51 AM »
#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.




Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #3 on: January 19, 2011, 09:20:27 AM »
#pragma lib "miracl.lib"
or
#pragma comment(lib, "miracl.lib")
May the source be with you

KKR_WE_RULE

  • Guest
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #4 on: January 19, 2011, 09:25:08 AM »
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 .

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #5 on: January 19, 2011, 09:53:48 AM »
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

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #6 on: January 19, 2011, 10:06:56 AM »
Code: [Select]
#pragma lib <miracl.lib>This assumes your library is located in the library search path defined for the project.

Code: [Select]
#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

  • Guest
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #7 on: January 19, 2011, 10:15:54 AM »
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

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #8 on: January 19, 2011, 10:44:05 AM »
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

  • Guest
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #9 on: January 19, 2011, 10:51:13 AM »
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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #10 on: January 19, 2011, 10:59:56 AM »
miracl.lib uses msvc libc.lib and is cdecl-lib.
Test this modified project.
May the source be with you

KKR_WE_RULE

  • Guest
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #11 on: January 19, 2011, 11:11:01 AM »
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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #12 on: January 19, 2011, 12:19:11 PM »
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

  • Guest
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #13 on: January 19, 2011, 12:33:12 PM »
I see.
Thanx very much for support guys :)

I am extremely pleased :)

Best Regards
KKR

KKR_WE_RULE

  • Guest
Re: Problem with Miracl Library (Shamus Softwares)
« Reply #14 on: January 20, 2011, 08:45:02 AM »
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 :)
« Last Edit: January 20, 2011, 08:48:45 AM by KKR_WE_RULE »