[hwloc-users] Single hwloc.h header files that work on linux and windows

2013-01-03 Thread Rolf vandeVaart

I have an application is supposed to work with both windows and linux.  To that 
end, I downloaded hwloc, configured and then included the hwloc header files in 
my application.  I dynamically load the libhwloc.so library and map the 
functions I need.  If libhwloc.so is not there, then I can still run but give a 
warning.  However, I have run into a problem.  hwloc.h includes a whole bunch 
of other headers, one of which is config.h.  And config.h is specific to how 
the library was configured.  Therefore, when I attempt to compile my 
application on windows, I get an error about missing pthread.h file.  This is 
probably one of many differences.

Is there a special hwloc.h and supporting headers that is system independent so 
I can include them and build on both windows and linux?  Or do I need to have 
two different sets of header files, one for linux and one for windows?   
Perhaps I just need a config.h for windows and one for linux and select them at 
build time.

Rolf

---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---


Re: [hwloc-users] Single hwloc.h header files that work on linux and windows

2013-01-03 Thread Samuel Thibault
Hello,

Rolf vandeVaart, le Thu 03 Jan 2013 22:30:58 +0100, a écrit :
> And config.h is specific to how the library was configured.

Not very much actually.

> Is there a special hwloc.h and supporting headers that is system independent 
> so
> I can include them and build on both windows and linux?

There isn't any at the moment.

> Or do I need to have two different sets of header files, one for linux
> and one for windows?  Perhaps I just need a config.h for windows and
> one for linux and select them at build time.

That should probably work.  The whole beginning of config.h is always
the same. The only generated parts is the following, with comments:

- HWLOC_LINUX_SYS: just to know whether we are on Linux. That could have
  been an #ifdef __linux__ actually.  That just defines whether
  hwloc_set_linuxfs_hooks is available, and enables some parts of the
  inlines, which you don't care about.

- HWLOC_HAVE_CPU_SET: That just defines whether we can provide the glibc
  inlines. Again, you don't care.

- HWLOC_HAVE_WINDOWS_H: Used only below in config.h, to provide the
  proper definition on windows or on Unix.

- hwloc_pid_t/hwloc_thread_t: will be either pid_t/pthread_t or HANDLE,
  depending on being on Unix or Windows.

- HWLOC_SYM_TRANSFORM, HWLOC_SYM_PREFIX, HWLOC_SYM_PREFIX_CAPS: These
  are only used for the embedded case, which I don't think you want to
  support.

So to summarize, having a windows version and a unix version should just
work.

Samuel