[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
unlink/rpl_unlink problem with MSVC
From: |
John W. Eaton |
Subject: |
unlink/rpl_unlink problem with MSVC |
Date: |
Sun, 24 Jan 2010 15:40:21 -0500 |
On 24-Jan-2010, Michael Goffioul wrote:
| I found yet another gnulib replacement problem with MSVC.
| This time with unlink. In liboctave, file_ops::unlink is correctly
| defined and exported, the problem is when linking liboctinterp:
| I get 2 undefined references to file_ops::rpl_unlink and Funlink.
| Indeed when I check the symbols in syscalls.o, I see
| Frpl_unlink instead of Funlink.
|
| Examining where it comes from, it looks to come from the
| gnulib version of unistd.h.
Here's a quick workaround. I haven't checked this in yet. I'd like
to fix all of these problems in a uniform way, and I haven't decided
yet how I want to do that.
jwe
diff --git a/liboctave/file-ops.cc b/liboctave/file-ops.cc
--- a/liboctave/file-ops.cc
+++ b/liboctave/file-ops.cc
@@ -337,7 +337,7 @@
}
else
{
- status = unlink (fullnm, msg);
+ status = xunlink (fullnm, msg);
if (status < 0)
break;
@@ -799,14 +799,14 @@
}
int
-file_ops::unlink (const std::string& name)
+file_ops::xunlink (const std::string& name)
{
std::string msg;
- return unlink (name, msg);
+ return xunlink (name, msg);
}
int
-file_ops::unlink (const std::string& name, std::string& msg)
+file_ops::xunlink (const std::string& name, std::string& msg)
{
msg = std::string ();
diff --git a/liboctave/file-ops.h b/liboctave/file-ops.h
--- a/liboctave/file-ops.h
+++ b/liboctave/file-ops.h
@@ -81,8 +81,8 @@
static int umask (mode_t);
- static int unlink (const std::string&);
- static int unlink (const std::string&, std::string&);
+ static int xunlink (const std::string&);
+ static int xunlink (const std::string&, std::string&);
static bool is_dir_sep (char c)
{
diff --git a/src/DLD-FUNCTIONS/urlwrite.cc b/src/DLD-FUNCTIONS/urlwrite.cc
--- a/src/DLD-FUNCTIONS/urlwrite.cc
+++ b/src/DLD-FUNCTIONS/urlwrite.cc
@@ -663,7 +663,7 @@
static void
cleanup_urlwrite (std::string filename)
{
- file_ops::unlink (filename);
+ file_ops::xunlink (filename);
}
static void
@@ -674,7 +674,7 @@
void delete_file (std::string file)
{
- file_ops::unlink (file);
+ file_ops::xunlink (file);
}
#endif
diff --git a/src/syscalls.cc b/src/syscalls.cc
--- a/src/syscalls.cc
+++ b/src/syscalls.cc
@@ -1247,7 +1247,7 @@
return retval;
}
-DEFUN (unlink, args, ,
+DEFUNX ("unlink", Funlink, args, ,
"-*- texinfo -*-\n\
@deftypefn {Built-in Function} address@hidden, @var{msg}] =} unlink
(@var{file})\n\
Delete the file named @var{file}.\n\
@@ -1272,7 +1272,7 @@
std::string msg;
- int status = file_ops::unlink (name, msg);
+ int status = file_ops::xunlink (name, msg);
retval(0) = status;
retval(1) = msg;