|
Post by raymcal on Apr 14, 2019 14:41:13 GMT -5
Hi. I'm totally blind, and a novice at C++. I'd like to write DLL's that are callable from LB. I use CodeBlocks for DLL-ing, and I have figured out how to get a DLL folder to happen, and the main.h and main.cpp files and all. What might be helpful to other LB-ers out there would be if we had a mock DLL that would do a couple useless but measurable things, and be callable easily in LB with simply theopen, code line, and close commands. Say, the sample dll would be able to add 2 numbers or subtract 2 numbers, so it would have 2 functions, which you'd forward declare in the main.h file. You could call these functions with the following 2 lines. calldll #m, "Add", 3 as long, 100 as long, answer as long or calldll #m, "Subtract", 2000 as long, 1500 as long, answer as long We'd need the code for the main.h and the main .cpp files, I believe. This might be helpful for many, and we could use this as a template to make all kinds of delightful dlls. Thanks. You can reply here, and/or also email me at raymcal@att.net as I am not sure if I get notifications of replies here, properly. Thanks.
|
|
|
Post by Chris Iverson on Apr 14, 2019 18:50:37 GMT -5
Not too bad an idea. Although we can't provide too much assistance with other programming languages, I don't mind providing a starting point. Here's an example Code::Blocks project, intended to be used with GCC(use the CodeBlocks + mingw package on Windows), along with an LB source file to test with. github.com/iversc/dll-example
|
|
|
Post by raymcal on Apr 15, 2019 21:54:56 GMT -5
Thanks. That is similar to the template from CodeBlocks. My problem was what to do if I didn't need the MessageBox function in it. When deleting that function, you still have to keep #include <windows.h> in the header file. I know c++ isn't really part of LB, but it is good to just have some basics, because there are some things that BASIC just doesn't do fast enough. Try iterative function system fractals where you need to run 20-30 million iterations to really get a clean image. Basic does it in 10 minutes, but C++ does it in 1 second. And, if you use polar coordinates to make a curly plant fractal, it takes even longer in BASIC. Previously, I've had to do these fractals in C++ by having a stand-alone C++ program where BASIC creates a text file, runs the C++ program which reads the text file, writes a bitmap, and ends, and then BASIC loads the bitmap. It works, but puts up an exe window when C++ is running so it kinda interrupts the screen. I'll see what dll-ing can do.
|
|