LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Static Libary Linking Error (VC 2008)

Hello,

 

I created a static library from VC 2008 and it worked well in my CVI 8.5 project. In the library there's an entry point named SomeModuleInit().

 

Then I added the following code segment and an additional library "PowrProf.lib" into my VC 2008 library. (other things the same)

 

======== 

#include <Powrprof.h>

 

int
GetPowerCapability(SLPMLibPowerCapability_t *pCapability)
{
 SYSTEM_POWER_CAPABILITIES cap;

 GetPwrCapabilities(&cap);     /* require PowrProf.lib */

 return TRUE;
}

 

=========

 

 

However, when compiling my project this time, the CVI linker complaint: Undefined Symbol '_SomeModuleInit' referenced in "Main.c".

 

Does anybody encounter the same problem?

0 Kudos
Message 1 of 3
(3,651 Views)

Seems like maybe you replaced your original library with the new one, so main can't see the original function SomeModuleInit?

 

Taking the linker at it's word (to anthropomorphize an inanimate object) it simply can't find the function in the original static library.

 

Did you accidentally replace the original library rather than add the new library to the project?

 

You say you added the new library to the VC2008 library - did you add it as source code?    Maybe there's some way to add a library to a library in VCPP rather than combining source code ...

0 Kudos
Message 2 of 3
(3,628 Views)

Hi menchar,

 

Thanks for your response.

For more detail, I was creating a static library which I would link it to my CVI project, because I need the power management functions in MS Visual Studio 2008 installed in my system.

Here is the relation:

PowrProf.lib ------> SLPM.lib ------> My CVI project

link by            VC                    CVI

 

And in fact, the symbol does exist in the library. Here is the symbol table output from dumpbin:

======================================

Microsoft (R) COFF/PE Dumper Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file SLPM2.lib

File Type: LIBRARY

COFF SYMBOL TABLE
000 007BC627 ABS    notype       Static       | @comp.id
001 00000000 SECT2  notype       External     | POWRPROF_NULL_THUNK_DATA

String Table Size = 0x1E bytes

COFF SYMBOL TABLE
000 007BC627 ABS    notype       Static       | @comp.id
001 00000000 SECT2  notype       External     | __NULL_IMPORT_DESCRIPTOR

String Table Size = 0x1D bytes

COFF SYMBOL TABLE
000 007BC627 ABS    notype       Static       | @comp.id
001 00000000 SECT2  notype       External     | __IMPORT_DESCRIPTOR_POWRPROF
002 C0000040 SECT2  notype       Section      | .idata$2
003 00000000 SECT3  notype       Static       | .idata$6
004 C0000040 UNDEF  notype       Section      | .idata$4
005 C0000040 UNDEF  notype       Section      | .idata$5
006 00000000 UNDEF  notype       External     | __NULL_IMPORT_DESCRIPTOR
007 00000000 UNDEF  notype       External     | POWRPROF_NULL_THUNK_DATA

String Table Size = 0x54 bytes

COFF SYMBOL TABLE
000 0083521E ABS    notype       Static       | @comp.id
001 00000001 ABS    notype       Static       | @feat.00
002 00000000 SECT1  notype       Static       | .drectve
    Section length   41, #relocs    0, #linenums    0, checksum        0
    Relocation CRC 00000000
005 00000000 SECT2  notype       Static       | .debug$S
    Section length 1C60, #relocs    0, #linenums    0, checksum        0
    Relocation CRC 00000000
008 00000000 SECT3  notype       Static       | .text
    Section length   15, #relocs    0, #linenums    0, checksum FF783A3B, selection    1 (pick no duplicates)
    Relocation CRC CF781669
00B 00000000 SECT4  notype       Static       | .debug$S
    Section length   E8, #relocs    5, #linenums    0, checksum        0, selection    5 (pick associative Section 0x3)
    Relocation CRC C5D29354
00E 00000000 SECT3  notype ()    External     | _SomeModuleInit@0
00F 00000000 SECT5  notype       Static       | .text
    Section length   37, #relocs    3, #linenums    0, checksum 47FA3144, selection    1 (pick no duplicates)
    Relocation CRC 59B502D3
012 00000000 SECT6  notype       Static       | .debug$S
    Section length  130, #relocs    5, #linenums    0, checksum        0, selection    5 (pick associative Section 0x5)
    Relocation CRC A8F36E59
015 00000000 SECT5  notype ()    External     | _ModuleGetPowerCapability@4
016 00000000 UNDEF  notype ()    External     | _GetPwrCapabilities@4
017 00000000 UNDEF  notype       External     | ___security_cookie
018 00000000 UNDEF  notype ()    External     | @__security_check_cookie@4
019 00000000 SECT7  notype       Static       | .debug$T
    Section length   64, #relocs    0, #linenums    0, checksum        0
    Relocation CRC 00000000

String Table Size = 0x76 bytes

  Summary

        1F41 .debug$S
          64 .debug$T
          41 .drectve
          14 .idata$2
          14 .idata$3
           4 .idata$4
           4 .idata$5
           E .idata$6
          4C .text

0 Kudos
Message 3 of 3
(3,620 Views)