(C++ question) I need to be able make a compiled code (like a .dll?) which other programmers can use on linux, win,, mac, etc.

The compiled code would simply do calculations and spit out an answer in memory.

I need it to have certain functions that they can easily call and understand (without actually seeing the source).

Does anyone know if this is possible and how?

Thanks in advance,
Tom.

Recommended Answers

All 2 Replies

Near as I can tell, basically what you want is to create your own library. Here's a link, that discusses using custom libraries. I think, your problem will be in making it cross compatible. You'll have to test and compile a different version for each Operating System, this could also mean each variation of them as well(i.e. XP, Vista, W7, W8, 32-bit, 64-bit, as well as the different service packs), or distribute the source to let each user compile their own

Compiling code that can be used on various systems is not simple, but you can direct some compilers, such as GCC, to emit ELF or COFF intermediate code that can subsequently be used to generate machine/OS-specific binaries. If you just want to "protect" your code, but let people use it on different systems and architectures (such as ARM vs x86 vs SPARC, etc), then you might consider using code obfuscation tools that will take your source code and make it unreadable, but still compilable into proper binary code on whatever system, though cross-platform software development is NOT simple, easy, or a subject for people who are not experts in software engineering. I speak as someone who has been doing just that for 30+ years...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.