0

Following this guide How to make a .lib file when have a .dll file and a header file I create the .lib file from .dll. For the .dll I have only a header file. After linking the library and call one from the function i got fatal error LNK1120.

Actually i use the .dll with the LoadLibrary() method. All functions listed from dumpbin /EXPORTS RFC1006Lib.dll can used with GetProcAddress(). So the functions exist and work. I tried the .lib in MSVC 2022 and Mingw32 with same result. Next I use implib.exe to generate .lib but in this case booth compilers say the format is wrong.

The .dll is downloaded from here: https://www.traeger.de/products/development/rfc1006/native/rfc1006-lib#downloads

How i try to compile the APP:

#pragma comment(lib, "isootcp/rfc.lib") //created lib from lib.exe and dumpbin.exe
#pragma comment(lib, "WS2_32.lib")

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <winsock.h>
#include <errno.h>
#include <io.h>
#include "isootcp/rfc1006lib.h" //given header from developer

void main(void)
{
long WINAPI handle = Rfc1006Open("10.196.72.5", "Erzer\0", 5, "TCP-1\0", 5, 0, 5000);
printf("Handle Result: %lu\n", handle);
}

Following the created .def for lib.exe:

EXPORTS
Rfc1006Close
Rfc1006Connect
Rfc1006Disconnect
Rfc1006GetSockErr
Rfc1006GetSockErrString
Rfc1006GetStatus
Rfc1006Open
Rfc1006OpenExServer
Rfc1006OpenServer
Rfc1006PacketInQ
Rfc1006Rx
Rfc1006SetFastAck
Rfc1006SetKeepAlive
Rfc1006StartServer
Rfc1006StopServer
Rfc1006Tx
Rfc1006TxUnlocked

I expect to link a working .lib in my project. I don´t like the LoadLibrary solution (create seperate header and much more work comparing with librarys).

Erz
  • 87
  • 7
  • why would you need to create a .lib yourself? the package you linked already has it along with the dlls and header files. – Martymoose Jun 17 '23 at 16:45

0 Answers0