|
I want to add the flexibility to my application to allow the user to write and use custom functions within the application. The functions would be added to a library. I don't want to write an interpreter. One thought I had was to let the user write C functions and write them to a dll source file, then my application could shellexecute a compiler and linker to generate the dll. The application could then turn around and call the dll function. All of this would be transparent to the user.
Now for the question. Can the VS C command line compiler and linker be shipped with my app?...I think I already know the answer, it would have to be licensed.
Is there a suitable free-ware compiler and linker that I could use?
Is there another way to skin this cat?...I don't want to try a VBA interface, but that might accomondate the largest audience.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
The lcc-win32 compiler system does just that. Many people use it exactly for that. Their users type a function, then it is compiled to a dll and loaded into the system.
Lcc-win32 has also the possibility of loading an object file "on the fly", not a Dll. This eliminates a lengthy link step, and links the code "live" to the system. But that algorithm has other drawbacks. The dll way is more portable and is not so much longer to perform.
The interesting thing is that your users will say they want to debug their functions. The lcc-win32 system features a debugger too.
jacob@jacob.remcomp.fr
http://www.cs.virginia.edu/~lcc-win32
|
|
|
|
|
Thanks, sounds like what I need...I will give it a look.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
|
I am about to install the lcc-win32. I am a little leary of installing things. Will the program steal any of the file associations from VC?
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
No, the VC compiler cannot be shipped with your product, unless you bundle in a copy (license) of VC.
A few options include:
1) gcc compilers (free)
2) Using the Script Host to support users writing in javascript and vbscript
3) embed your own macro language (I have done this in the past and you will want to avoid this if at all possible!)
4) programmatically post the user-entered code to a service on your web site, compile it and return the DLL as the result (or error page)
|
|
|
|
|
These have possibilities, I will have to look into them.
basementman wrote:
1) gcc compilers (free)
2) Using the Script Host to support users writing in javascript and vbscript
The others make my feeble head hurt
Thanks for your reply
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Can't say I much like the idea of "end-users" running compilers etc. unless they are technically competant, and even then this doesn't sound right.
Using the Scripting Host is one solution, then users can write in JScript, VBScript, Perl (heaven forbid) etc.
Another is a C Interpreter, which is what I do in ED (see sig). Have a look at UnderC http://home.mweb.co.za/sd/sdonovan/underc.html[^] I haven't actually used this, but I'm suitably impressed with what Steve is doing.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
Can't say I much like the idea of "end-users" running compilers etc. unless they are technically competant, and even then this doesn't sound right
I would be interested in your reasons why. The app would take care of setting the proper compiler and linker switches and report any errors generated by either. how is this functionally different than running an interpreter? I am not arguing with you, I never miss an opportunity to learn new things.
Neville Franks wrote:
Have a look at UnderC
Thanks for the link...looks interesting, but I am worried about speed. my program, among other things is doing rather large monte carlo dispersions. I have the same concern about the scripting host
Thanks for your reply
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Gary Kirkham wrote:
I would be interested in your reasons why. The app would take care of setting the proper compiler and linker switches and report any errors generated by either.
It seems like a lot of extra baggage and effort to distribute compilers and linkers. And potentially more difficult for the end user. Interpreters offer several advantages, one being there is no edit, compile, link, run cycle.
Interpreted code can also typically access all functions in your app. Conpiled code in DLL couldn't easilly do that.
Gary Kirkham wrote:
but I am worried about speed. my program, among other things is doing rather large monte carlo dispersions. I have the same concern about the scripting host
Scripted code is typically used for UI stuff, not CPU intensive operations. It can always call compiled code to perform such tasks.
A large part of ED (see sig) is written in its C Extension Language. This is compiled into virtual machine code which is interpreted at run time. The compiler is called on demand whenever a source file is edited, so the user doesn't even know about having to run a compiler. The Under C code is a pure interpreter with no separate compile phase that the user sees.
I think you need a clear idea of the functionality you want to provide, and how that can interact with your application code and then work out what will work for you.
Hope that helps.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
To whom it may concern,
I know people dont like to help out students. But I am a student and I the reason I am coming here to ask my question is not because I'm lazy, but because I dont know where to go to get the right information. For school, I was asked to write a database management system in C++, or in any other language of choice. I was wondering if anybody could tell me in what language it would be easier to write such system. And if so, how I could start, and if there is a helpful library that I could use to help myself, because I dont want to have to reinvent the wheel either! I would like some helpful information that helps me out to start out. Thanks everyone!!;P
GabyGirl
Ps. can anyone else give me ideas as to how to start. And... by reinventing the wheel, I mean, whether I have to design a way to store my records in arrays or something...
|
|
|
|
|
Try Visual Basic here:
http://www.freevbcode.com/listcode.asp?Category=4[^]
it is easier than C++ if you are a beginner.
jhaga
CodeProject House, Paul Watson wrote:
...and the roar of John Simmons own personal Nascar in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving her *c.* and Deb scoffing chocolates in the corner.
...Good heavens!
|
|
|
|
|
I guess I dont understand what you meant by "reinvent the wheel". The whole exercise of writing DBMS is actually to do it from scratch so students will know the hurdles of writing good DBMS. Anyway, I believe C++ is good for you especially in doing DBMS, especially it will reinforce the OO programming that, believe me, you will actually use at workplace; at least in my company we do. If you want speed over good OO design, you can always go with C. To parse SQL, unfortunately you'll have to do C (using yacc and bison). The core engine can still be in C++ though. If you dont want to use SQL, you can always go with procedural calls too. I did a simple DBMS system with SQL interface for my last semester project using C++, group of 2. It wasnt that hard at all, kinda fun actually. Just go slowly but surely; dont expect you'll get Oracle out of it. Good luck!
|
|
|
|
|
Could someone explain to be how to figure out the size of something in bits?
example:
how many bits is
char buf[1024]
float buf[1024]
double buf[1024]
int buf[1024]
I know if I have the number of bits on each on then I can divide by 8 to get the number of bytes.
Do I have the idea or am I way off?
Sorry for the newbie question
steven
|
|
|
|
|
In terms of C++ and windows OS:
char -> 8 bits
float -> 32 bits (4 bytes)
double -> 64 bits (8 bytes)
int -> 32 bits (4 bytes)
Kuphryn
|
|
|
|
|
I understand that, but if the I wanted to know the size of
char [1024] would it be (8 * 1024)= 8192 bits and 1024 bytes?
steven
|
|
|
|
|
|
johnstonsk wrote:
I know if I have the number of bits on each on then I can divide by 8 to get the number of bytes.
If you know that bits ÷ 8 = bytes, then you must also know that bytes * 8 = bits.
|
|
|
|
|
Well, 8 bits is always a byte.
Generally speaking the number of bytes that a particular type uses can vary depending on the platform and the language. Some languages, like Java, define the size of specific types.
If you want to evaluate the number of bytes something is using then I suggest trying the sizeof[^] operator in C. Do a search on sizeof and you will find references for other languages such as the .NET framework.
--
"The money power of the country will endeavor to prolong its rule by preying upon the prejudices of the people until all wealth is concentrated in a few hands and the Republic destroyed."
-- Abraham Lincoln
|
|
|
|
|
Note that this:
char[3]
can take 32 bits (!) due to alignment.
On a 64 bit computer it should take 64 bits. so:
char[9] would use the space of 128 bits.
if you newed an array it would probably take even more space, due to the fact that the heap has to be managed in some way.
|
|
|
|
|
is it possible to open the audio in and audio out of the sound card at the same time and playback something that is different from the input to line in.
|
|
|
|
|
Yes and no (or... maybe).
Of course you can output audio that's different from what you get from audio in. However, to "playback something that is different from the input [to line in]" seems impossible unless you're willing to bring out the soldering iron.
|
|
|
|
|
Yes, just about every sound device these days support simultaneous record and playback.
There are two things:
1. You might have to record and playback at the same rate. Probably not, but best to play safe.
2. On the mixer control panel, make sure on the output mixer you disable 'Line in' or that will get mixed into the output.
Elaine
The tigress is here
|
|
|
|
|
I linked a file type with my program, such that if you double click on a file in explorer, it opens the file using my program. The only problem is if there's an instance of the program already open I want that instance to open the file rather than starting a new instance. (for example, if you double click a .doc file, you do not want start a new Word session if one is already open. Instead you want the existing word session to open the document).
Anyone have any ideas on the best way to do this?
John
|
|
|
|
|
While not a direct answer to your question, you can start with these two references:
http://www.naughter.com/sinstance.html
http://www.flounder.com/nomultiples.htm
|
|
|
|