Help with simple dll wrapper around linux so

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
Starry
Newbie
Newbie
Posts: 3
Joined: Wed Jun 09, 2010 5:28 pm

Help with simple dll wrapper around linux so

Post by Starry »

Ive recently got metatrader to work on linux uner wine and would now like to see if i can import a dll wrapper so i can use some code i wrote in linux. Im trying something like this (based on http://www.winehq.org/docs/winelib-guide/bindlls) :

add.c:

Code: Select all

int add(int a,int b) {
  return a+b;
}
add.h:
int add(int,int);
WinAdd.c:

WinAdd.c:

Code: Select all

#include <windef.h>
#include "add.h" 
int WINAPI WinAdd (int a,int b) {
   return add(a,b);
}
WinAdd.dll.spec:

Code: Select all

2 stdcall WinAdd (long long) WinAdd



now, i have these all in a directory called test. I type:

Code: Select all

winemaker . --nosource-fix --nomfc  -iadd  --single-target WinAdd -L"."
(ive already compiled to libadd.so for linux), and then run

Code: Select all

make
And i get:

Code: Select all

winegcc  -o WinAdd.so add.o WinAdd.o    -L.   -ladd  
/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: *** [WinAdd.so] Error 2

Can anyone please help?
wine version is 1.1.42 and im on ubuntu
THanks :D
jorl17
Level 5
Level 5
Posts: 365
Joined: Mon Jul 28, 2008 6:44 pm

Post by jorl17 »

winemaker . --nosource-fix --nomfc -iadd --single-target WinAdd -L"."
Try adding --dll to those options. I should note that I have no experience with this...but are you sure that you did the rest ok? I'm guessing that "--dll" will make it compile, the question is if the rest is ok.

Cheers,

Jorl17
Starry
Newbie
Newbie
Posts: 3
Joined: Wed Jun 09, 2010 5:28 pm

Post by Starry »

Tried it but didnt work :cry: Im not really sure if its all right i though i had pretty much did what the document said to do. Clearly not :o
Starry
Newbie
Newbie
Posts: 3
Joined: Wed Jun 09, 2010 5:28 pm

Post by Starry »

Anyone? I tried loading an ea which loads a dll, but loading the dll failed, it saying 'something tried to load the c library incorrectly' . Hmmm...
din99
Level 2
Level 2
Posts: 29
Joined: Sat May 31, 2008 11:37 am

Post by din99 »

look at the mt4 settings to allow dll, and headers (.h) are called .mqh
Locked