Posts: 83
Threads: 22
Joined: Dec 2004
Lets say i have a C++ program with some functions and I compile it into a .obj, but I want to make a lib out of it? i searched google but got crap. can anyone help me with this? thanks.
f a fly walked, would it be called a walk?
Why dosn't someone make a word that rymes with purple or orange?
WHY AM I SO ANNOYING? Becuase I wanna!
Why am I typeing this? Cuz im bored!
Posts: 1,439
Threads: 15
Joined: Apr 2003
What compiler are you using? (And this should perhaps be in General Programming, no?)
Posts: 83
Threads: 22
Joined: Dec 2004
Well... it IS after all, help in qb. But I am using QB45, but I just stumbled over an ASM file that kinda showed me how to do this, but I still need more... eg how do I pass arguments! I wish I could find that one tutorial I found on this...
f a fly walked, would it be called a walk?
Why dosn't someone make a word that rymes with purple or orange?
WHY AM I SO ANNOYING? Becuase I wanna!
Why am I typeing this? Cuz im bored!
Posts: 1,439
Threads: 15
Joined: Apr 2003
Ah, you want to use a C++ library from QB?
You didn't specify what C++ compiler you're using, but I'll assume that you actually mean a C compiler (or a C++ compiler set to use regular C names instead of C++ mangling) - if not, you'll have to have some fun with assembly language. Also, I'll assume you have access to the C source code and can rebuild the library. Make sure the procedures are all UPPERCASE names because of the way QB does case-insensitive linking. Then declare the functions in QB as such:
Code:
/* C code */
int ADDNUMS(int a, int b) { return a + b };
''' QB code
DECLARE FUNCTION ADDNUM CDECL (BYVAL a AS INTEGER, BYVAL b AS INTEGER) AS INTEGER
And there you have it. Make sure you link with the C lib on the LINK command line (add it to the libraries section). You can use the LIB command to make a library out of .OBJs.
Posts: 83
Threads: 22
Joined: Dec 2004
ok, thanks, i will try that
f a fly walked, would it be called a walk?
Why dosn't someone make a word that rymes with purple or orange?
WHY AM I SO ANNOYING? Becuase I wanna!
Why am I typeing this? Cuz im bored!
Posts: 357
Threads: 118
Joined: Oct 2004
C++ is object oriented, Qbasic is not. That could cause you some headaches. Use C or ASM.
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Posts: 50
Threads: 4
Joined: Mar 2005
am the last survivor of the Quickbasics world (at least at qbasicnews).