News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

C++ static Library in Masm

Started by ragdog, January 16, 2013, 09:48:51 PM

Previous topic - Next topic

ragdog

Hey Community

I use a C++ Static Library in my masm32 project and it works perfect.
Now is the question must i use this switches in my linker settings LINK /NODEFAULTLIB:LIBC.LIB /NODEFAULTLIB:OLDNAMES.LIB

I have this source of the C++Library can i change it with visual studio that i can use without this linker switches?

Greets,

Vortex

Hi ragdog,

Your questions are not very clear. You tell that you use perfectly the static library but you have some issues with the linker settings.

You need to check the dependencies of your static library. Without any information, you are limited with the trial and error method.

Try the static library with the default Visual Studio settings. While building the project, possible error messages will help you to solve the problems.

ragdog

I use the Original Miracl lib in Masm32 it works

But i must add in my linker settings from masm add  /NODEFAULTLIB:LIBC.LIB /NODEFAULTLIB:OLDNAMES.LIB

Without this settings have i this error from Masm32 linker

LINK : fatal error LNK1104: cannot open file "LIBCMT.lib"

Now have i think i Recompile this Miracl.lib with Visual studio and now is the question
can i set any setting in  the C++ Cl.exe

Ok

And other question have i rebuild this Library and compile i my Masm32 project have i a messages box
"The Program cannot run....
MSVCRT90.dll is missing....."

Thats my Build Libaray batch


set file="test"
set PATH=C:\Program Files\Microsoft Visual Studio 9.0\VC\bin;%PATH%
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.0\Include;C:\Program Files\Microsoft Visual Studio 9.0\VC\include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.0\lib;C:\Program Files\Microsoft Visual Studio 9.0\VC\lib;%LIB%

rem Compile MIRACL modules
copy mirdef.h32 mirdef.h
cl /c /O2 /W3 mrcore.c
...
..
.
rem
rem Create library 'miracl.lib'
del miracl.lib

lib /OUT:miracl.lib mrflsh4.obj mrflsh3.obj mrflsh2.obj mrpi.obj mrflsh1.obj
lib /OUT:miracl.lib miracl.lib mrdouble.obj mrflash.obj mrfrnd.obj mrround.obj mrbuild.obj
lib /OUT:miracl.lib miracl.lib mrio2.obj mrio1.obj mrrand.obj mrprime.obj mrcrt.obj mrscrt.obj mrfast.obj
lib /OUT:miracl.lib miracl.lib mrjack.obj mrxgcd.obj mrgcd.obj  mrarth3.obj mrarth2.obj mrpower.obj mrsroot.obj
lib /OUT:miracl.lib miracl.lib mrmonty.obj mralloc.obj mrarth1.obj mrarth0.obj mrsmall.obj mrcore.obj mrmuldv.obj
lib /OUT:miracl.lib miracl.lib mrcurve.obj mrshs.obj mraes.obj mrlucas.obj mrstrong.obj mrbrick.obj mrbits.obj
lib /OUT:miracl.lib miracl.lib mrshs256.obj mrshs512.obj mrebrick.obj mrgf2m.obj mrec2m.obj mrzzn2.obj mrzzn3.obj mrzzn4.obj
lib /OUT:miracl.lib miracl.lib mrecn2.obj mrzzn2b.obj mrgcm.obj


Have you a idea to fix thsi Mscrt90.dll error
and how i can use without this masm32 linker settings

"/NODEFAULTLIB:LIBCMT.lib /NODEFAULTLIB:LIBC.LIB /NODEFAULTLIB:OLDNAMES.LIB "

Regards,

Vortex

Hi ragdog,

msvcrt90.dll is a dependency. LIBCMT.lib is another one. You have to modify your source code of the static library to remove the dependency to libcmt.lib but this is not an easy job. You will have to replace the C run-time functions with your own version. For the moment, you need to add libcmt.lib to your Masm project.

Redistribution of the shared C runtime component in Visual C++ :

http://support.microsoft.com/kb/326922/en-us

msvcr90.dll is a member of Microsoft Visual C++ 2008

ragdog

YEs but the original lib works without the msvcr90.dll
Only i recompile it must i use it.

Here is the Archiv of Miracl (last version)


Or give a solution to change the call Name

;;  - add renamed to adi
;;  - instr renamed to instrz
;;  - size renamed to isize

to a other without recompile the lib that i can use the original Library?

I can not use

Invoke add
Invoke instr
invoke size

this must a rename it

Greets,

Vortex

Hi ragdog,

I don't have an installation of VS on my computer. Did you keep track of other additional libraries used by VS? I see that you managed to eliminate msvcr90.dll

ragdog

QuoteDid you keep track of other additional libraries used by VS? I see that you managed to eliminate msvcr90.dll

I understand not what your mean

I have installed GRMSDK_EN_DVD 7.0 and 7.1
Now Visual studio 2008 Trail version

And add this

set file="test"
set PATH=C:\Program Files\Microsoft Visual Studio 9.0\VC\bin;%PATH%
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.0\Include;C:\Program Files\Microsoft Visual Studio 9.0\VC\include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.0\lib;C:\Program Files\Microsoft Visual Studio 9.0\VC\lib;%LIB%


to the Original ms32doit.bat from Mircal package

The Miracl SDK + source can your found here

https://certivox.com/

And in this package contain a MIRACL/blob/master/msvisual.txt

Quote
To create a new version of the MIRACL library, first create a suitable
mirdef.h as above, then

1. Click on New and Project, and select "Visual C++ Projects", "Win32",
   enter the name Miracl and click on "Win32 Project" and then OK.

2. Click on "Application Settings", and then select "Static Library".
   Then click on Finish

3. Add in the appropriate files mr*.c. (Project followed by "Add Existing Items").

4. Click on Project and then "Properties". Open up the C++ Tab, go to "Precompiled
   Headers", and select "Not using precompiled headers" from the drop-down box.
   Open the "General" Tab, and specify a path to the miracl header files, mirdef.h
   and miracl.h

5. Now build the project.

ragdog

Hey Communtity

I Have solved it with lib now translate i a c++ code into masm

Can your any help me by this code


        p=rand(512,2);        // random 512 bit number
        if (p%2==0) p+=1;
        while (!prime(p)) p+=2;

Gunther

Hi  ragdog,

put your code into a function, compile it with the compiler switch -S (generates an assembly listing) and let the compiler do the dirty work.

Gunther
You have to know the facts before you can distort them.

qWord

Quote from: ragdog on January 21, 2013, 04:19:41 AMCan your any help me by this code


        p=rand(512,2);        // random 512 bit number
        if (p%2==0) p+=1;
        while (!prime(p)) p+=2;

Without further context, I would say that you must look up the overloaded operator for the type of p.
AFAICS the code seems to generate a prime number from an random integer value by first ensure that the lowest bit in p is set ( if(p%s)p+=1) and then add 2 until prime() return true...
MREAL macros - when you need floating point arithmetic while assembling!