Hey everyone. I have the need to use the miniupnp UPnP C library for my requirements.
https://github.com/miniupnp/miniupnpNow, I have downloaded the source and included
ZIP path New folder
------------- ----------------
include\*.h -- > miniupnp
src\*.c -- > miniupnp
Now, I have the folder "miniupnp" containing the required files.
I create a new win64 static library project, and add "miniupnp.c" to my project tree. Compiles successfully.
libminiupnp.lib (25.2 KB)
Now, I copy the "miniupnp" directory to (Pelles C - Program Files) -> \Include\miniupnp
Now, in my main project requiring the library use, I added
#include <miniupnpc/miniupnpc.h>
#pragma comment(lib, "libminiupnpc.lib")
However, calling any of the functions required it does not resolve any external symbols. I do not know what to do from here.
I see on the GIT there are files (a .def file too) for building DLL, a .rc file for that too etc.
DEF file:
LIBRARY
; miniupnpc library
miniupnpc
EXPORTS
; miniupnpc
upnpDiscover
upnpDiscoverDevice
upnpDiscoverDevices
upnpDiscoverAll
freeUPNPDevlist
parserootdesc
UPNP_GetValidIGD
UPNP_GetIGDFromUrl
GetUPNPUrls
FreeUPNPUrls
; miniwget
miniwget
miniwget_getaddr
; upnpcommands
UPNP_GetTotalBytesSent
UPNP_GetTotalBytesReceived
UPNP_GetTotalPacketsSent
UPNP_GetTotalPacketsReceived
UPNP_GetStatusInfo
UPNP_GetConnectionTypeInfo
UPNP_GetExternalIPAddress
UPNP_GetLinkLayerMaxBitRates
UPNP_AddPortMapping
UPNP_AddAnyPortMapping
UPNP_DeletePortMapping
UPNP_DeletePortMappingRange
UPNP_GetPortMappingNumberOfEntries
UPNP_GetSpecificPortMappingEntry
UPNP_GetGenericPortMappingEntry
UPNP_GetListOfPortMappings
UPNP_AddPinhole
UPNP_CheckPinholeWorking
UPNP_UpdatePinhole
UPNP_GetPinholePackets
UPNP_DeletePinhole
UPNP_GetFirewallStatus
UPNP_GetOutboundPinholeTimeout
; upnperrors
strupnperror
; portlistingparse
ParsePortListing
FreePortListing
But this is for a DLL. What exactly am I missing here? This is what I used for testing:
void testMiniUPnP() {
// Discover UPnP devices on the network
int error;
struct UPNPDev* devlist = upnpDiscover(1000, NULL, NULL, 0, 0, 2, &error);
if (devlist == NULL) {
printf("No UPnP devices found. Error code: %d\n", error);
return;
}
// Iterate through the list of discovered devices
struct UPNPDev* device = devlist;
while (device) {
printf("Device: %s\n", device->descURL);
// Perform additional actions if needed
// Move to the next device in the list
device = device->pNext;
}
// Free the device list
freeUPNPDevlist(devlist);
}
Any help appreciated!
Lib project is attached for review.