<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/105910>105910</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            lld-link error undefined symbol __declspec(dllimport)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          determin1st
      </td>
    </tr>
</table>

<pre>
    Dear sirs,

i was trying to build php extension with clang+llvm but lld-link give me errors:
```
lld-link: error: undefined symbol: __declspec(dllimport) zend_object_std_init
>>> referenced by sync-64.obj:(PORTABLE_InitZendObject)
>>> referenced by sync-64.obj:(sync_Mutex_create_object)
>>> referenced by sync-64.obj:(sync_Semaphore_create_object)
>>> referenced 3 more times

lld-link: error: undefined symbol: __declspec(dllimport) _ecalloc
>>> referenced by sync-64.obj:(sync_Mutex_create_object)
>>> referenced by sync-64.obj:(sync_Semaphore_create_object)
>>> referenced by sync-64.obj:(sync_Event_create_object)
>>> referenced 2 more times

lld-link: error: undefined symbol: __declspec(dllimport) rc_dtor_func
>>> referenced by sync-64.obj:(zim_sync_Semaphore_unlock)

lld-link: error: undefined symbol: __declspec(dllimport) _emalloc
>>> referenced by sync-64.obj:(zim_sync_ReaderWriter___construct)
>>> referenced by sync-64.obj:(zim_sync_SharedMemory___construct)
>>> referenced by sync-64.obj:(zim_sync_SharedMemory_read)

lld-link: error: undefined symbol: __declspec(dllimport) _efree
>>> referenced by sync-64.obj:(zim_sync_ReaderWriter___construct)
>>> referenced by sync-64.obj:(zim_sync_SharedMemory___construct)
```

all these are located in `php8.lib` which i supplied. it was compiled/built probably with MSVC compiler. i launched "dumpbin" utility to make sure symbols are there:

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


Dump of file php8.lib

File Type: LIBRARY

 Exports

       ordinal    name

...
 zend_object_std_init@@16
...
...(very very long list of symbols here)..
...
```

what might be the reason `lld-link.exe` doesnt "see" only those symbols?




</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVkFv2zoM_jXKhaghK4ljH3xo0wYYsGJDN-zhvYshW0ysVZYMSk7r_foHOWmbbuuhxXpYYCiKRX4iPzIkpfd6ZxFLtrxgy8uZHELrqFQYkDptUx9mtVNjeYmSwGvyTKwZv2T8_LBquJMeAo3a7iA4qAdtFPRtD3gf0HrtLNzp0EJjpN0xcWHMvoN6CGCMOjPa3sJO7xE6BCRy5Nn8iMwyfnymnw_ibH5-kIybwSrcaosK_NjVzsR3VaWwMb7HholcGaO73lFgooAfaFXl6u_YhMoHVWmrw_Gu-dXhAcItEtoGFdQj-NE2Z9kicfX3aJfIP3-6-Xp-8fGq-mB1-A-t-jTBMVG8Eii-qK6HgPdVQygDHg17I9IX7GTfOsLXoM2hc4QQdIf-NKZ_gOoKG2mMa_5CVl5Eu9qjDa9BEu_HLzWVCo6q7WBfy_EP3VU_sTNY45rbJ2f-XBZ0b8mCRwtvUCqkf0gHpKqqGmd9oOEtAXxyupWE6ho7R-N7QBJK9R5Ebgnxr6LxefU-rNIYCC16BEkIxjUyoAJtgWW8b_s8MbpmGYe7VjctaPBD3xuNKgEdpj7TuK7XBhUTm9hoAvTkalmb8dBjrr98Wz_IUAIajBxs06ICJoQaur7WlgkBQ9BGhzH2q07eIviB8BgHP5kWWiR86kS_8-haN-S82wZgIr-JQVp_2myY2Hy-gsuh65HgG9LU_9JFIopkztNlmhy1164fSe_aSXsdtZ_w1o56RzJoZxOAc2NgkvRA6JH2qJJnZk1rvBHcFrbaIDxSeSKwiQdfxz56BR8_XNyc3_x7eg5X9zHZntUpOHwcKW2liVsrOzyVSJKjLb_vrQvOFjzNfpKNG5HvkUaYFuPsDoz2ITrwEIUpAKI41Xk5r-5aGaCb6Kyn4AGh9G7Kq4d_X4L3GHNLOfQ20i48YkwGZ80IoXX-MQXYfPMrw4d1psq5Kua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