Home > Archive > Clarion > September 2006 > Using External DLLs
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Using External DLLs
|
|
| ChaosKCW 2006-08-13, 7:55 am |
| Hi
I have succesfully used the windows.dll before, but now am trying to
use a 3rd party dll. I keep getting unresolved external references on
the "DPlot_Start". Here is what I have in a clw file.
SECTION('Equates')
SECTION('Prototypes')
MODULE('DPLOTLIB.DLL')
!DPlot_Start(SHORT Minimize, *SHORT WasActive),HANDLE,PASCAL,RAW
DPlot_Start(LONG, *LONG),HANDLE,C,RAW,NAME('DPlot_Start')
END
The file is included inside the global map.
My call looks liek this:
DPlot_Start(0, wasActive)
The DLL is included inside the application folder.
What else needs to be done to make Clarion load a DLL ?
Thanks,
| |
| ChaosKCW 2006-08-14, 6:55 pm |
| Hi
Can anyone at least tell me if "MODULE" will dynammically load a dll
(not a lib, a dLL!) like delphi etc... or is this lilke the oh so
annoying C and only supports libs?
If it doesnt support DLLs are there examples of how to to use
loadlibrary and getprocaddress in clarion? Speicifcally protoypes? How
do you specify a prototype in clarion? The advanced guide doesnt even
mention loadlibrary, just "module".
Thanks,
ChaosKCW wrote:
> Hi
>
> I have succesfully used the windows.dll before, but now am trying to
> use a 3rd party dll. I keep getting unresolved external references on
> the "DPlot_Start". Here is what I have in a clw file.
>
> SECTION('Equates')
> SECTION('Prototypes')
>
>
> MODULE('DPLOTLIB.DLL')
>
>
> !DPlot_Start(SHORT Minimize, *SHORT WasActive),HANDLE,PASCAL,RAW
> DPlot_Start(LONG, *LONG),HANDLE,C,RAW,NAME('DPlot_Start')
>
> END
>
>
> The file is included inside the global map.
>
> My call looks liek this:
>
> DPlot_Start(0, wasActive)
>
> The DLL is included inside the application folder.
>
> What else needs to be done to make Clarion load a DLL ?
>
> Thanks,
| |
| clackmannan 2006-08-14, 6:55 pm |
|
> Can anyone at least tell me if "MODULE" will dynammically load a dll
> (not a lib, a dLL!) like delphi etc... or is this lilke the oh so
> annoying C and only supports libs?
The latter
If you want dynamically loaded stuff you have to write it yourself
If you're happy using static libs then run Libmaker on the DLL in
question and save a CW-compatible lib somewhere, and then add it to the
project so it gets linked in at compile time.
> If it doesnt support DLLs are there examples of how to to use
> loadlibrary and getprocaddress in clarion? Speicifcally protoypes? How
> do you specify a prototype in clarion? The advanced guide doesnt even
> mention loadlibrary, just "module".
You can try http://attryde.com/clarion/cwdll.htm for the short version.
Also think about subscribing to www.clarionmag.com, Jim Kane has some
very useful articles on dynamically loading/calling procedures
Paul
| |
| ChaosKCW 2006-08-16, 3:55 am |
| Hi
Thanks for the information. Where do I find this libmaker? Is it part
of clarion?
Thanks,
clackmannan wrote:
>
> The latter
>
> If you want dynamically loaded stuff you have to write it yourself
>
> If you're happy using static libs then run Libmaker on the DLL in
> question and save a CW-compatible lib somewhere, and then add it to the
> project so it gets linked in at compile time.
>
>
> You can try http://attryde.com/clarion/cwdll.htm for the short version.
> Also think about subscribing to www.clarionmag.com, Jim Kane has some
> very useful articles on dynamically loading/calling procedures
>
> Paul
| |
| clackmannan 2006-08-16, 6:55 pm |
|
ChaosKCW wrote:
> Hi
>
> Thanks for the information. Where do I find this libmaker? Is it part
> of clarion?
>
Yes, it should be in the \c6\bin folder
Paul
| |
| ChaosKCW 2006-08-26, 3:55 am |
| Hi
I have used libmaker succesfully now, but continue to get unresolved
external reference. I opened the lib in a text editor and the function
is there and it is spelled exactly right. Can one of you clarion gurus
help me out here?
I have a dll (DPLOTLIB.DLL) and a lib maker .lib file (dplotlib2.lib),
I have placed the lib file and the dll in the application folder.
I have included the equates section in the after global includes emebd
point.
I have included the prototypes section in the inside global map.
I am calling the function from procuedre hooked to a menu.
I followed the design of the CLW files generated by winapi.exe. So my
clw file looks like this:
SECTION('Equates')
HANDLE EQUATE(UNSIGNED)
DPLOT_DDE_VERSION EQUATE(3)
SECTION('Prototypes')
MODULE('dplotlib2.lib')
DPlot_Start(LONG, *LONG),HANDLE,C,RAW
DPlot_Stop(),PASCAL,RAW
END
My code simple calls dplot_start, but I keep getting unresolved
external references?
Is there somewhere I must include the lib file for static linking?
Is there a step I have missed?
Any help would be appreciated.
Thanks,
Stephen
| |
| clackmannan 2006-08-27, 6:55 pm |
|
ChaosKCW wrote:
> Hi
>
> I have used libmaker succesfully now, but continue to get unresolved
> external reference. I opened the lib in a text editor and the function
> is there and it is spelled exactly right. Can one of you clarion gurus
> help me out here?
>
> I have a dll (DPLOTLIB.DLL) and a lib maker .lib file (dplotlib2.lib),
> I have placed the lib file and the dll in the application folder.
> I have included the equates section in the after global includes emebd
> point.
> I have included the prototypes section in the inside global map.
>
> I am calling the function from procuedre hooked to a menu.
>
> I followed the design of the CLW files generated by winapi.exe. So my
> clw file looks like this:
>
> SECTION('Equates')
>
> HANDLE EQUATE(UNSIGNED)
>
> DPLOT_DDE_VERSION EQUATE(3)
>
>
> SECTION('Prototypes')
>
>
> MODULE('dplotlib2.lib')
>
> DPlot_Start(LONG, *LONG),HANDLE,C,RAW
> DPlot_Stop(),PASCAL,RAW
>
> END
>
> My code simple calls dplot_start, but I keep getting unresolved
> external references?
>
> Is there somewhere I must include the lib file for static linking?
>
> Is there a step I have missed?
>
> Any help would be appreciated.
>
> Thanks,
>
> Stephen
The only silly question is the one that isn't asked... :)
Did you add the .lib file into the project (.prj) file ?
Paul
| |
| ChaosKCW 2006-09-09, 6:55 pm |
| Not that I know of, I just placed it it in the project folder assuming
the "module" keyword would pick it up.
How do I add it to the prj file ?
Thanks,
clackmannan wrote:
> ChaosKCW wrote:
>
> The only silly question is the one that isn't asked... :)
>
> Did you add the .lib file into the project (.prj) file ?
>
> Paul
| |
| clackmannan 2006-09-11, 7:55 am |
|
ChaosKCW wrote:
> Not that I know of, I just placed it it in the project folder assuming
> the "module" keyword would pick it up.
No, there's more to it than that
> How do I add it to the prj file ?
Project->Edit
Expand the tree control and find the section labelled "library, object,
resource files"
Click the "add file" button on the right hand side and go find the .lib
file
HTH,
Paul
| |
| ChaosKCW 2006-09-11, 6:55 pm |
| Hi
Thanks a million for your help, thats fixed my compile problem. Now to
fix the memory violations that occur after that :-)
Wish me luck :-)
C
clackmannan wrote:
> ChaosKCW wrote:
>
> No, there's more to it than that
>
>
> Project->Edit
> Expand the tree control and find the section labelled "library, object,
> resource files"
> Click the "add file" button on the right hand side and go find the .lib
> file
>
> HTH,
> Paul
|
|
|
|
|