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
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>".
#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.
#pragma lib "miracl.lib"
or
#pragma comment(lib, "miracl.lib")
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 .
If you have compiled the library on yourself be sure to have compiled it with the same calling convention of your code.
#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?
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
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.
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
miracl.lib uses msvc libc.lib and is cdecl-lib.
Test this modified project.
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
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.
I see.
Thanx very much for support guys :)
I am extremely pleased :)
Best Regards
KKR
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 :)
Did you follow the advice of the users manual, which is a separate download?
QuoteTo assist with the configuration process, a file config.c is provided. When compiled
and run on the target processor it automatically generates a mirdef.h file and gives
general advice on configuration. It also generates a miracl.lst file with a list of MIRACL
modules to be included in the associated library build. Experimentation with this
program is strongly encouraged. When compiling this program DO NOT use any
compiler optimization.
I tried to compile it, but it never compiles :(
Create an empty "Win32 Console Application (EXE)" project.
Copy config.c into the project folder.
Select "Project => Add files to project" and select config.c
Select "Project => Project options"
Select the Compiler tab
Set Optimizations to None
Hit OK
Build the project and ignore the warning about unused variables
Run the created EXE file and follow the instructions
Now you have build a custom mirdef.tst file, which would be your mirdef.h file.
The miracl.lst file would be used to compile your custom miracl.lib.
Those functions exist in ntdll.dll
ntdll-1.def
LIBRARY NTDLL.DLL
EXPORTS
_alldiv
_allmul
_allrem
_allshl
_atoi64
_aulldiv
_aulldvrm
polib.exe /DEF:ntdll-1.def /OUT:ntdll-1.lib /MACHINE :X86
try that library with it.
Did exactly as directed in the above post.
I replaced by old mirdef.h file with the newly created one.
I also placed the copied the miracl.lst to the same folder .
But I still get same errors.
Now ?
*edit*
@timovjl : How do I import a dll functions in C ?
I can do it in Delphi, but dunno how to do it in C :(
br
KKR
In this case make that library first to project folder.
Then add that import library to project.
http://forum.pellesc.de/index.php?topic=3272.msg12340#msg12340 (http://forum.pellesc.de/index.php?topic=3272.msg12340#msg12340)
From menu Project -> Project options ... -> Linker tab
add to Library and object files:
But this means, my exe wont run without that .dll file .
Thats annoying.
Any work around to it ?
br
KKR
Don't copy that ntdll.dll.
That import library ntdll-1.lib is needed only when linking that program.
I've added that polib thing, but I am not quite sure, what to do next :(
To be frank, I am bit confused :(
- copy ntdll-1.lib to project folder
- add ntdll-1.lib to project linker options
From menu Project -> Project options... -> Linker tab add to Library and object files:
Alright.. All fixed :)
Hello!
In this library there are two types ECn and Big. As can be established between them to convert?
I have tried:
ECn x;
Big y;
y = (Big) x;
x = (ECn) y;
Is NOT running :(
In the archive big.cpp, big.h, ecn.cpp, ecn.h and manual.doc.
Quote from: MHX on February 27, 2011, 04:54:53 AM
In the archive big.cpp, big.h, ecn.cpp, ecn.h and manual.doc.
The attached file are C++ source code - Pelles C is "only" a C compiler.
Quote from: AlexN on February 27, 2011, 01:20:44 PM
Quote from: MHX on February 27, 2011, 04:54:53 AM
In the archive big.cpp, big.h, ecn.cpp, ecn.h and manual.doc.
The attached file are C++ source code - Pelles C is "only" a C compiler.
Sorry, I did not quite understand in English. What do you mean "Pelles C "? Complete library is "MIRACL" from the site http://www.shamus.ie/index.php?page=Downloads (http://www.shamus.ie/index.php?page=Downloads)
Files ending in .CPP are C++ source files, which are not compatible with ANSI C.
In rare cases, they are ANSI C file and can be used by Pelles C.
There is a big difference between C and C++.
Hi there. I'm new in C++ and I just found out the MIRACL library to perform cryptography.
I tried compile the sample code in Visual C++ , in which the code is included inside the library folder (http://www.shamus.ie/index.php?page=Downloads). It end up with some errors. I had add the miracl.lib and the header file big.h, miracl.h, mirdef.h, zzn.h inside the project too. Am I missing out some library which should be included? Or is there anyway to solve this?
Quote
1>sample.cpp
1>Linking...
1>sample.obj : error LNK2019: unresolved external symbol "class Flash __cdecl pow(class Flash const &,class Flash const &)" (?pow@@YA?AVFlash@@ABV1@0@Z) referenced in function _main
1>sample.obj : error LNK2019: unresolved external symbol "class Flash __cdecl exp(class Flash const &)" (?exp@@YA?AVFlash@@ABV1@@Z) referenced in function _main
1>sample.obj : error LNK2019: unresolved external symbol "class Flash __cdecl operator*(class Flash const &,class Flash const &)" (??D@YA?AVFlash@@ABV0@0@Z) referenced in function _main
1>sample.obj : error LNK2019: unresolved external symbol "class Flash __cdecl sqrt(class Flash const &)" (?sqrt@@YA?AVFlash@@ABV1@@Z) referenced in function _main
1>sample.obj : error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class Flash const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABVFlash@@@Z) referenced in function _main
1>sample.obj : error LNK2019: unresolved external symbol "class Flash __cdecl pi(void)" (?pi@@YA?AVFlash@@XZ) referenced in function _main
1>C:\Users\User\Documents\Visual Studio 2008\Projects\brent\Debug\brent.exe : fatal error LNK1120: 6 unresolved externals
1>Build log was saved at "file://c:\Users\User\Documents\Visual Studio 2008\Projects\brent\brent\Debug\BuildLog.htm"
1>brent - 7 error(s), 0 warning(s)
Pelles C does not support C++ at all, it is only supporting plain ANSI C.
You would better ask at a C++ or Visual Studio forum.
opps my mistake. Thanks anyway! :)
Hi,
I m writing some crypto functions using Miracl library.
My problem is about arrays. I want to let user input the
size of the array (type:big). How can I do that?
Quote from: mutluceengineer on December 18, 2012, 09:06:44 PM
I m writing some crypto functions using Miracl library.
My problem is about arrays. I want to let user input the
size of the array (type:big). How can I do that?
Lookup scanf() and malloc() in your help file....