independent string functions

C

Cartoper

There is one little static C library to manage the serial number and
unlock key for my application. Today it is compiled with Microsoft
VC6 and linked into both VC6 modules and VS2005 modules. It is not a
lot of code, but obviously it is very important code that is used all
over:

VS2005: used in a C++/CLI module for .Net
VS2005: Apache module
VC6: DLL that is called by the installation program

There are two things I need to do:

1: Upgrade the VC6 module to VS2005.
2: Prepare this static library to go cross platform.

As it stands now the ONLY functions the library is using from the CRT
are string manipulation functions, the library does not allocate any
memory right now and is pure C. I am looking for an alternative to
the standard string functions, something I can simply include in this
library so that it is 100% self contains and won’t run into issues
when I compile it with VS2005 (later VS2008) nor with the Linux and
Mac C/C++ compilers.

Cartoper

P.S. I know .Net is not cross platform, so that is going to be
totally rewritten, too.
 
J

jacob navia

Cartoper said:
There is one little static C library to manage the serial number and
unlock key for my application. Today it is compiled with Microsoft
VC6 and linked into both VC6 modules and VS2005 modules. It is not a
lot of code, but obviously it is very important code that is used all
over:

VS2005: used in a C++/CLI module for .Net
VS2005: Apache module
VC6: DLL that is called by the installation program

There are two things I need to do:

1: Upgrade the VC6 module to VS2005.
2: Prepare this static library to go cross platform.

As it stands now the ONLY functions the library is using from the CRT
are string manipulation functions, the library does not allocate any
memory right now and is pure C. I am looking for an alternative to
the standard string functions, something I can simply include in this
library so that it is 100% self contains and won’t run into issues
when I compile it with VS2005 (later VS2008) nor with the Linux and
Mac C/C++ compilers.

Cartoper

P.S. I know .Net is not cross platform, so that is going to be
totally rewritten, too.

I can give you the source code for any string library function.
Then your library would be self contained.
For pricing address the mail address below (in the .sig)

Alternatively you could go fishing for the source code of those
functions, they are not very difficult to find.

You can start at

www.google.com/codesearch.
 
J

Joachim Schmitz

Cartoper said:
As it stands now the ONLY functions the library is using from the CRT
are string manipulation functions, the library does not allocate any
memory right now and is pure C. I am looking for an alternative to
the standard string functions, something I can simply include in this
library so that it is 100% self contains and won’t run into issues
when I compile it with VS2005 (later VS2008) nor with the Linux and
Mac C/C++ compilers.
Why not using the string functions the standard C library provides? What
issue do you expect to run into, when using stands C string functions on
implementations that do (claim to) provide a standard comformant C compiler
whith a standard conformant C library? After all that is what protable
programming is all about, isn't it?

Bye, Jojo
 
B

Ben Bacarisse

Cartoper said:
There is one little static C library to manage the serial number and
unlock key for my application. Today it is compiled with Microsoft
VC6 and linked into both VC6 modules and VS2005 modules. It is not a
lot of code, but obviously it is very important code that is used all
over:

VS2005: used in a C++/CLI module for .Net
VS2005: Apache module
VC6: DLL that is called by the installation program

There are two things I need to do:

1: Upgrade the VC6 module to VS2005.
2: Prepare this static library to go cross platform.

As it stands now the ONLY functions the library is using from the CRT
are string manipulation functions, the library does not allocate any
memory right now and is pure C. I am looking for an alternative to
the standard string functions, something I can simply include in this
library so that it is 100% self contains and won’t run into issues
when I compile it with VS2005 (later VS2008) nor with the Linux and
Mac C/C++ compilers.

I must be missing something obvious, but why can't you just keep using
C's string functions? Your library is in C, so obviously you can link
C code into all the desired targets. I can't see why you can't also
just link against the C library.

Anyway, if you list the ones that the library uses, I am sure people
here can post versions written in portable C. The only hard ones are
the scanf and printf family. You might want to say what formats you
actually use since that can make a difference as to how hard a
re-write it is.

Obviously, there are open-source versions available, so you'll also
have to say what licences are acceptable.
 
C

Cartoper

I must be missing something obvious, but why can't you just keep using
C's string functions?  Your library is in C, so obviously you can link
C code into all the desired targets.  I can't see why you can't also
just link against the C library.

Yea, the issue is with Microsoft compilers. As of VS2005 it has
warnings all over the place about using strcpy, strcat and wants you
to use the safer strcpy_s and strcat_s. Also with Microsoft's stuff,
there are hoops to jump though with VS2005 when dealing with the
runtime that I simply don't want to have to contend with in this
little static library.
Anyway, if you list the ones that the library uses, I am sure people
here can post versions written in portable C.  The only hard ones are
the scanf and printf family.  You might want to say what formats you
actually use since that can make a difference as to how hard a
re-write it is.

I am not using sprintf or sscanf, just the standard strcpy, strcat,
strlen, etc.
Obviously, there are open-source versions available, so you'll also
have to say what licences are acceptable.

GPL won't work because the source is closed, for obvious reasons, I
need something that can stay closed source. This IS the code that
does the decryption of the unlock key, so it is sort of important to
keep it closed source;)
 
N

Nick Keighley

me too
Yea, the issue is with Microsoft compilers.  As of VS2005 it has
warnings all over the place about using strcpy, strcat and wants you
to use the safer strcpy_s and strcat_s.

it is pretty to suppress this error (I consider it an error
in the compiler not your program).

 Also with Microsoft's stuff,
there are hoops to jump though with VS2005 when dealing with the
runtime that I simply don't want to have to contend with in this
little static library.

what hoops? Can't you ifdef it out?

#ifdef WIN32
for (i = 0; i < hoop_count; i++)
jump_through_hoop (i);
#endif

I am not using sprintf or sscanf, just the standard strcpy, strcat,
strlen, etc.


GPL won't work because the source is closed, for obvious reasons, I
need something that can stay closed source.  This IS the code that
does the decryption of the unlock key, so it is sort of important to
keep it closed source;)

I still think the best solution is to just use the standard
library functions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top