K8055 on plain old C code in XP; linkage problem with .dll

Hello,

trying to get speed to my K8055 from C code, using the gcc compiler/linker,
(the board works well and fine with the supplied test exe on XP)

the linker wont find the routines called into the K8055D.dll;

however I have no K8055D.lib in my distribution, which seems odd, only a K8055D_c.lib

(in my world each xxx.dll generation also results in a corresponding xxx.lib to be used at linkage
am I wrong ? )

BR georg

There is only K8055D.LIB available for the Borland C++ Builder.
It is in the examples folder of the latest DLL package: velleman.eu/distributor/supp … code=K8055

There is no (Microsoft C) .LIB file available for the K8055D.DLL.
You have to use an explicit DLL linking to link the K8055D.DLL to your C code.

Please see also these threads:
viewtopic.php?f=3&t=6614
viewtopic.php?f=3&t=5693

Hi !

thanks for a quick answer, however, wouldnt it be a piece of cake for velleman to include
another .lib that could be used for fixed linking with a .dll for c (c++, are these the same ? no)

ok, I know that the multiplicity of variants gets bogging to have update and check, but … :slight_smile:

I will try out the runtime linking, while that seem much more cumbersome than letting
the linker work…

tnx again
georg

It does not have to do with the programming language. Both Borland and Microsoft compilers generate a different format for their .lib files. Borland generates lib files in OMF format, Microsoft generates them in COFF format. Both are not interchangeable.

So, if the DLL was written in Borland Delphi (now Embarcadero Delphi), the corresponding .lib file will be in OMF format and will not be useable in Microsoft Visual Studio. Same thing goes the other way around.

Thus whether the .lib file can be used has absolutely nothing to do with a programming language, but with the programming environment.

As a sidenote, a .lib file is simply a definition of where the linker can find the functions inside the DLL, sort of like a list (very simplistically put). And if the linker can’t interpret that list (doesn’t know the format), the software won’t link.

Hi again,

with using runtime linkage as proposed, the program links ok, i.e. the linker seem satisfied,
however it wanted 2 parameters declared when accessing the procedure, where
the procedure only had one defined for its parameter passing

in the exampel you referred to these two parameters were also differntly defined
dwParam1 and uParam2 (DWORD and UINT resp).

so what are these; the second one being the passing of the routine parameter ?
while the first is the return value from the routine/function in case it
is defined to give a return value ?

<<
anyway running the produced exe produces a return value of -1 for calling the opendev
(indicating success ?) ( the runtime connecting seem to be successfull)

while a return of 0 for calling the setDigitalChannel (indicating fail, connecting also seem
successfull)

Also in the Velleman supplied .h file (I guess should be used for C / c++)

it is declared as dllexport, I guess that that is to be changed to dllimport ?

sorry that file is not to be used when runtime importing ?

so would VC++ 2008 Express use the same ways as gcc as per last entry in
by vel255 in:

viewtopic.php?f=3&t=4063

Runtime linking under Windows is done with LoadLibrary and GetProcAddress. If you are using runtime linking you do not need the header file.

We don’t have any experience with gcc, except from compiling Linux applications.

Take a look at other posts on this forum to see how runtime linking is done
viewtopic.php?f=3&t=6201&p=23226&hilit=GetProcAddress+K8055#p23226
viewtopic.php?f=3&t=3624&hilit=GetProcAddress+K8055

Hi again;

the mr WATERPOLO code of
viewtopic.php?f=3&t=3624&hilit=GetProcAddress+K8055

works just fine, and is straight forward C code, however the boolean
definition of func5 type definition was too much for the complier :frowning:
why I haven’t figured out. removing it (and including the K8055.cpp inline
instead of include which I found unecessary) everything went right through

tnx

It seems the func5 is the only one returning a “bool”.
Maybe there is some problem with the “bool”…
Please see: viewtopic.php?f=3&t=2307

Indeed, the type ‘bool’ does not exist in C, make it return int instead