miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[patch] Changes for MinGW (using Fedora cross-tools)

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> libnatpmp Compilation/Installation
View previous topic :: View next topic  
Author Message
rb07



Joined: 31 May 2009
Posts: 8

PostPosted: Sun May 31, 2009 1:41 am    Post subject: [patch] Changes for MinGW (using Fedora cross-tools) Reply with quote

This is the complement of the patch for miniupnp I did in the course of building Transmission (1.61) for Windows (Gtk and Qt GUI).

The version included in Transmission is libnatpmp-20090310.

Code:
diff -NaurX diff-excludes.txt transmission-1.61-orig/third-party/libnatpmp/getgateway.c transmission-1.61/third-party/libnatpmp/getgateway.c
--- transmission-1.61-orig/third-party/libnatpmp/getgateway.c   2009-05-12 00:32:39.000000000 +0000
+++ transmission-1.61/third-party/libnatpmp/getgateway.c   2009-05-23 07:57:31.809390788 +0000
@@ -261,7 +261,7 @@
 #endif /* #ifdef USE_SOCKET_ROUTE */
 
 #ifdef USE_WIN32_CODE
-int getdefaultgateway(in_addr_t * addr)
+LIBSPEC int getdefaultgateway(in_addr_t * addr)
 {
    HKEY networkCardsKey;
    HKEY networkCardKey;
diff -NaurX diff-excludes.txt transmission-1.61-orig/third-party/libnatpmp/natpmp.c transmission-1.61/third-party/libnatpmp/natpmp.c
--- transmission-1.61-orig/third-party/libnatpmp/natpmp.c   2009-05-12 00:32:39.000000000 +0000
+++ transmission-1.61/third-party/libnatpmp/natpmp.c   2009-05-23 08:03:09.821359878 +0000
@@ -18,8 +18,9 @@
 #include <time.h>
 #include <sys/time.h>
 #ifdef WIN32
+#include <errno.h>
 #include <winsock2.h>
-#include <Ws2tcpip.h>
+#include <ws2tcpip.h>
 #include <io.h>
 #define EWOULDBLOCK WSAEWOULDBLOCK
 #define ECONNREFUSED WSAECONNREFUSED
@@ -34,7 +35,7 @@
 #include "natpmp.h"
 #include "getgateway.h"
 
-int initnatpmp(natpmp_t * p)
+LIBSPEC int initnatpmp(natpmp_t * p)
 {
 #ifdef WIN32
    u_long ioctlArg = 1;
@@ -70,7 +71,7 @@
    return 0;
 }
 
-int closenatpmp(natpmp_t * p)
+LIBSPEC int closenatpmp(natpmp_t * p)
 {
    if(!p)
       return NATPMP_ERR_INVALIDARGS;
@@ -113,7 +114,7 @@
    return n;
 }
 
-int getnatpmprequesttimeout(natpmp_t * p, struct timeval * timeout)
+LIBSPEC int getnatpmprequesttimeout(natpmp_t * p, struct timeval * timeout)
 {
    struct timeval now;
    if(!p || !timeout)
@@ -131,7 +132,7 @@
    return 0;
 }
 
-int sendpublicaddressrequest(natpmp_t * p)
+LIBSPEC int sendpublicaddressrequest(natpmp_t * p)
 {
    if(!p)
       return NATPMP_ERR_INVALIDARGS;
@@ -143,7 +144,7 @@
    return sendnatpmprequest(p);
 }
 
-int sendnewportmappingrequest(natpmp_t * p, int protocol,
+LIBSPEC int sendnewportmappingrequest(natpmp_t * p, int protocol,
                               uint16_t privateport, uint16_t publicport,
                        uint32_t lifetime)
 {
@@ -228,7 +229,7 @@
    return n;
 }
 
-int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)
+LIBSPEC int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)
 {
    int n;
    if(!p || !response)
@@ -268,7 +269,7 @@
 }
 
 #ifdef ENABLE_STRNATPMPERR
-const char * strnatpmperr(int r)
+LIBSPEC const char * strnatpmperr(int r)
 {
    const char * s;
    switch(r) {


Additionally I had to make the following addition to Transmission's configure, this would translate to something similar in Makefile:

Code:
+     LDFLAGS="$LDFLAGS -no-undefined"

_________________
R.B.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1429

PostPosted: Thu Jun 04, 2009 10:25 pm    Post subject: Reply with quote

thank you
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> libnatpmp Compilation/Installation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.