|
-
Aug 13th, 2017, 03:31 PM
#1
Thread Starter
Lively Member
Is possible to combine C source code with Visual Basic 6?
Hi!
I need to use source code written in C with my application whch is written in Visual Basic 6.
I have no choice, I don't know C and must to use existing.
Is possible to combine C and VB6 code in single application?
Thank you for each help.
Miro
-
Aug 13th, 2017, 03:39 PM
#2
Re: Is possible to combine C source code with Visual Basic 6?
Yes and no
No you can't combine the code
Yes you can create a dll and use it in your VB project.
-
Aug 13th, 2017, 03:40 PM
#3
Re: Is possible to combine C source code with Visual Basic 6?
Wouldn't that be great! If the C code was written as, and compiled into, a DLL, then it is possible. But raw source code from another language needs to be converted to VB
Ah, DM beat me to it
-
Aug 13th, 2017, 06:39 PM
#4
Thread Starter
Lively Member
Re: Is possible to combine C source code with Visual Basic 6?
Ok, how to create DLL for C sources?
Is Visual C++ backward compatible with C?
How to create DLL? Even, how to call DLL?
Application in C has no one parameter - after start searches for file in same directory as app and process it...
Can you help?
Miro
-
Aug 13th, 2017, 06:51 PM
#5
Re: Is possible to combine C source code with Visual Basic 6?
If the C code behaves in that way then converting it to a DLL could be a lot of work, especially if this isn't something you have done before. Depending on the complexity of the C code it might be possible to rewrite it in VB.
-
Aug 13th, 2017, 07:38 PM
#6
Thread Starter
Lively Member
Re: Is possible to combine C source code with Visual Basic 6?
It is very simple code - in less than 100 lines. Sources are 5 and else 3.
These codes I tried to convert by converter - it failed in some parts - so I'm not able to do it...
It is simple tool to render images for Commodore 128 VDC chip - 5 and 3 sources are for 8 modes totally.
Miro
-
Aug 13th, 2017, 08:00 PM
#7
Re: Is possible to combine C source code with Visual Basic 6?
Sounds like you could just compile the C code into an exe and shell to it from your vb program
-
Aug 13th, 2017, 08:10 PM
#8
Thread Starter
Lively Member
Re: Is possible to combine C source code with Visual Basic 6?
Yes, it is alternative, but problem is that it outputs to console during rendering - outputs curent processing column number.
Miro
-
Aug 13th, 2017, 08:18 PM
#9
Re: Is possible to combine C source code with Visual Basic 6?
Where do you want to output it?
You could just run the code in a cmd window and redirect the output to a file then read the file into a VB program if needed.
C:\Users\passel>Ccode.exe > VDCchipImage.dat
C:\Users\passel>
-
Aug 13th, 2017, 09:02 PM
#10
Thread Starter
Lively Member
Re: Is possible to combine C source code with Visual Basic 6?
For test I tried to use it by shortcut:
cmd /c render.exe > output.txt
and set window minimized.
Process was indicating in taskbar and output to file was empty, when I restore window I see progress...
Only one problem is here - how to hide application indication in tasksbar?
Not yet applied in VB.
Miro
-
Aug 13th, 2017, 10:04 PM
#11
Re: Is possible to combine C source code with Visual Basic 6?
You may want to try the abandoned ThunderVB project. Download it either from PSC or SourceForge.
-
Aug 14th, 2017, 06:45 AM
#12
Re: Is possible to combine C source code with Visual Basic 6?
If you just post your source here, there are a bunch of us fluent in C and many other languages.
I just posted some source in the C/C++ thread on how to deal with a ParamArray from C, but it sounds like it would be sooo much easier just converting it by hand.
and yes VC can compile C.
http://www.vbforums.com/showthread.p...n-C-export-DLL
-
Aug 14th, 2017, 08:03 AM
#13
Thread Starter
Lively Member
Re: Is possible to combine C source code with Visual Basic 6?
I know that C source code is published under GNU GPL, but I know author personally and must to ask if can I publish it here.
Miro
-
Aug 14th, 2017, 08:21 AM
#14
Re: Is possible to combine C source code with Visual Basic 6?
 Originally Posted by MIRKOSOFT
I know that C source code is published under GNU GPL, but I know author personally and must to ask if can I publish it here.
Miro
you could just post a link to it?
-
Aug 14th, 2017, 08:22 AM
#15
Re: Is possible to combine C source code with Visual Basic 6?
Vic
Somewhat off-topic, but how did you do that?
I've modified your string by adding "x" so it just appears here as text ..
[xCENTER][xATTACH=xCONFIG]150621[x/ATTACH][x/CENTER]
Could you explain
Is it a video?
Spoo
-
Aug 14th, 2017, 08:27 AM
#16
Re: Is possible to combine C source code with Visual Basic 6?
 Originally Posted by Spooman
Vic
Somewhat off-topic, but how did you do that?
I've modified your string by adding "x" so it just appears here as text ..
[xCENTER][xATTACH=xCONFIG]150621[x/ATTACH][x/CENTER]
Could you explain
Is it a video?
Spoo
are you asking how he created the animated GIF ? He just lifted it from whoever made the PSC post.
-
Aug 14th, 2017, 08:50 AM
#17
Fanatic Member
Re: Is possible to combine C source code with Visual Basic 6?
I used Visual C++ same generation as VB6, compile some DLL in it, and called it from VB, it is just the _stdcall , the only one thing is to export the functions the dll must provide to VB.
Then place it next to the APP EXE, and just use it.
The easier is using all parameters in 32bits, so the signature must be long long long...., include if in the VB you uses it as boolean, or integer, it is in real LONGs, include strings, strings it is just a LONG pointer to the string header, then from the header you must read the pointer to the string itself, ooooor strptr to pass directly the pointer to the string. Then it is the things C++ likes null terminated strings, or you do special C code to read the LENGTH at [StrPtrr-4] IIRC
Include the DLL will always works as a function, include if it is VOID, it is structured as a function, the Return value is passed in EAX.
that is the _stdcall. All is passed by stack, and locals are allocated in stack, x86 is perfectly designed to do that, but you don't see that fact in C++, the language abstracts that well. You will see those facts if coding in ASM, which also I did. As an old asm guy.
-
Aug 14th, 2017, 09:11 AM
#18
Thread Starter
Lively Member
Re: Is possible to combine C source code with Visual Basic 6?
Ok, I do all possible to contact creator of code 'cause friend usedit from other man.
I'll reply when I will know if is possible to publish it.
Miro
-
Aug 14th, 2017, 11:02 AM
#19
Re: Is possible to combine C source code with Visual Basic 6?
 Originally Posted by DEXWERX
are you asking how he created the animated GIF ? He just lifted it from whoever made the PSC post.
OK, thanks
I've never used animated GIF before.
Spoo
-
Aug 16th, 2017, 05:51 AM
#20
Thread Starter
Lively Member
Re: Is possible to combine C source code with Visual Basic 6?
Ok, I have agreement to publish sources in C.
Have I create code parts in text or attach them to post?
Miro
-
Aug 16th, 2017, 08:00 AM
#21
Re: Is possible to combine C source code with Visual Basic 6?
Hmmm, through the years, I've been involved with a couple of different applications that were written in C. However, these were stand-alone applications, and we didn't compile anything to a DLL. I must admit that I've had very little to do with C++.
Another thing I was a bit more recently involved with was dealing with a few Fortran algorithms. Using the Microsoft Fortran Compiler, I was able to create a standard callable DLL that's called from VB6. And I don't remember this being a great deal of work.
With admittedly somewhat limited knowledge, it's a bit confusing to me why one couldn't just find a C compiler that would create a standard DLL that could be called from VB6. I'm guessing that an ActiveX DLL might be more work. However, if all we're after is certain algorithms, it seems that a standard DLL could get it done.
Best Regards,
Elroy
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Aug 16th, 2017, 07:23 PM
#22
Thread Starter
Lively Member
Re: Is possible to combine C source code with Visual Basic 6?
So, I attached files in ZIP.
I hope that anybody has bit of time to help me by converting it to Visual Basic.
I tried converter but some parts marked as error and in VB source was original code line.
About files:
****************
VDC file lines
---------------------
hfli_quant.c 231
i3vdc_quant.c 217
image.c 211
image.h 38
ivdc_quant.c 226
matrix.h 24
vdc_quant.c 228
================
VGA file lines
---------------------
hfli_quant.c 231
image.c 211
image.h 38
matrix.h 24
tfli_quant.c 231
****************
some files looking same, but I'm not able to be sure 'cause don't know C.
Thank you all for at least reading it.
Miro
C.zip
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|