Re: how do i link 3rd party lib on windows ?

From: CBFalconer (cbfalconer_at_yahoo.com)
Date: 09/27/04


Date: Mon, 27 Sep 2004 15:06:34 GMT

Jacques wrote:
>
> I'm pretty new to C, so this is probably an elementary question....
>
> I'm trying to write a simple c program that calls a function in a
> third party library. I would then like to link this to a dll. The
> files that were supplied to me by are :
> a .lib file
> a .h file
> a .dll
>
> So... I've written a simple C program like so :
>
> #include "SecondTry.h"
> #include <stdio.h>
> #include "jni.h"
> #include "qabwved.h"
>
> JNIEXPORT void JNICALL Java_SecondTry_helloWorld(JNIEnv *env,
> jobject obj)
> {
> printf("Hello world !\n");
> //calling external lib function...
> QABatchWV_Startup(1);
> return;
> }
>
> I'm using the lcc-win32 compiler / linker on Windows 2000.
> It compiles fine with the following command line :
>
> lcc -Id:\j2sdk1.4.2_03\include -Id:\j2sdk1.4.2_03\include\win32
> -Id:\dev\c\second_try\java -Id:\dev\Qas_app\C SecondTryImpl.c
>
> The problem starts when trying to link it with :
>
> lcclnk -dll qabwved.lib secondtryimpl.obj -o secondtry.dll
>
> I'm getting the following error :
>
> secondtryimpl.obj .text: undefined reference to
> '__imp__QABatchWV_Startup'
>
> The function QABatchWV_Startup is defined in the .h file that
> I've received. I assumed that the implementation would be in
> the .lib that I've received.

lcc-win32 is a non-standard C system, and off-topic on both c.l.c
and c.l.c++. Almost anything crossposted to c.l.c and c.l.c++ is
off-topic on at least one. However this will be on-topic in
comp.compilers.lcc, to which I have cross-posted this and set
followups. Go there for any replies.

c.l.c is devoted to the portable C language only. This does not
include any extensions and/or third party libraries.

-- 
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


Relevant Pages

  • Re: how do i link 3rd party lib on windows ?
    ... Jacques wrote: ... I would then like to link this to a dll. ... > a .lib file ... include any extensions and/or third party libraries. ...
    (comp.lang.c)
  • Re: Success Through Cluelessness
    ... > object in my lib file would crash. ... And where do you think the "C++ objects like fstream" are implemented? ... Precisely in the CRT. ... DLL or EXE) will have it's own copy of the CRT, ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Compiling C DLLs for reuse in MC++?
    ... and link with the lib file" ... a DLL file, no lib. ... new GUI for it in either C# or MC++, ... I've never made a native DLL before and successfully used it. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Dll lib
    ... A DLL is a collection of code that is linked at some point, ... A .lib file contains information that tells the linker how to resolve symbols at link ... REFERENCE to the DLL and the information about the names in a.obj, ... This can be further refined to really mean "implicit dynamic linking" ...
    (microsoft.public.vc.mfc)
  • Success Through Cluelessness
    ... Recently I was having a problem where the creation of an fstream object ... The lib file was linked to a managed dll. ... multithreaded libraries are required. ...
    (microsoft.public.dotnet.languages.vc)

Loading