Seth,

Take a look at the source code to the CUDA 3.0 wrapper I just finished. You have some mistakes in your coding and this should help provide you a better example. When I first was coding the CUDA 2.0 wrapper some people told me to look at opengl and how it was wrapper to the linux library so that is how I came up with this.

http://shelnutt2.host56.com/wrapper.tar.gz

Generally the specfile goes like

@� stdcall cudaGetDeviceProperties( ptr long ) wine_cudaGetDeviceProperties

Then in your .c file:

cudaError_t WINAPI wine_cudaGetDeviceProperties(
struct cudaDeviceProp *prop, int device) {
��� WINE_TRACE("\n");
��� return cudaGetDeviceProperties(prop, device);
}


Also your linking looks off. You shouldn't be linking -l"." . You need to specify the exact file, like for CUDA we did -lcudart or -lcufft.

I hope that help you some.

-Seth Shelnutt


On Wed, Jun 16, 2010 at 2:04 AM, Seth Burleigh <seth@tewebs.com> wrote:
Im attempting to build a dll which a windows program running under wine
can dynamically load. The dll will be a wrapper around a linux library.
In preparation ive tried to follow the instructions here
http://www.winehq.org/docs/winelib-guide/bindlls
with a simple example but have not succeeded. Below is the contents of
the files in my directory and the commands i executed. Can anyone help
out? Thanks!



MyLinuxFunc.c
� � � �int MyLinuxFunc(int a,int b) {
� � � � � � � �return a+b;
� � � �}
-----------------------------
MyLinuxFunc.h
� � � �int MyLinuxFunc(int,int);
-----------------------------
libMyLinuxFunc.so
-----------------------------
MyWin.dll.spec
� �2 stdcall MyWinFunc (long long) MyProxyWinFunc
-----------------------------
MyWin.c

� � � �#include <MyLinuxFunc.h>
� � � �#include <windef.h>
� � � �int WINAPI MyProxyWinFunc (int a,int b)
� � � �{
� � � � return MyLinuxFunc(a,b);
� � � �}
-----------------------------


winemaker . --nosource-fix --dll --single-target MyWin --nomfc -I"."
-L"." -iMyLinuxFunc

make
winegcc �-o MyWin.so MyLinuxFunc.o MyWin.o � �-L. � -lMyLinuxFunc
MyWin.o: In function `MyProxyWinFunc':
MyWin.c:(.text+0x20): undefined reference to `MyLinuxFunc'
/usr/lib/wine/libwinecrt0.a(exe_main.o): In function `main':
(.text+0xa0): undefined reference to `WinMain'
collect2: ld returned 1 exit status
winegcc: i486-linux-gnu-gcc failed
make: *** [MyWin.so] Error 2