I'm attempting to write a small wrapper around libxml2. Here is some test code to try and access the functions and present the error:

---
package provide test 0.1
package require tcc4tcl

set LibPath [file join [file dirname [dict get [info frame [info frame]] file]]]

# Object encapsulating C code
set c [::tcc4tcl::new]

# Add library paths
$c add_include_path [file join $LibPath include]
$c add_include_path [file join $LibPath include libxml]
$c add_library_path $LibPath
$c add_library libxml2-2

# Try to use xmlLineNumbersDefault
$c cproc test {} ok {
    xmlLineNumbersDefault(1);
}

# Compile C code
$c go
---

The LibPath variable is set such that it is the location of the 'test' package (where I'd like to put the include files and library). Printing it verifies this path is always as expected.

The above fails when [package require test] is invoked within any directory except the package's directory. When within the package's directory the package loads fine.

The error returned when running [package require test] from outside its directory:

tcc: error: undefined symbol 'xmlLineNumbersDefault'
relocating failed

The accompanying stack trace:

tcc: error: undefined symbol 'xmlLineNumbersDefault'
relocating failed
    while executing
"tcc command $procname $cname"
    (procedure "::tcc4tcl::_go" line 106)
    invoked from within
"::tcc4tcl::_go ::tcc4tcl::tcc_1 0"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 [list $callcmd $handle {*}$args]"
    (procedure "::tcc4tcl::tcc_1" line 19)
    invoked from within
"$c go"
    (file line 30)
    invoked from within
"source
    ("package ifneeded test 0.1" script)
    invoked from within
"package require test"
    ("uplevel" body line 1)
    invoked from within