Web lists-archives.org

Re: [Mingw-users] Help exporting functions from an exe




On 09.03.2010 1:57, Douglas G. Danforth wrote:
> Just a comment on the words you used
>
> "The exe needs to export functions to the dll"
>
> That makes no sense.  An exe file does not export functions or variables..
> A dll file can indeed have exports that can be imported by other dlls or 
> exes.
>   
AFAIK  an exe-file can have DllMain() (along with main() or WinMain() or
whatever) and can export functions just as good as a dll-file.
> -Doug Danforth
>
> arcana25 wrote:
>   
>> I'm trying to build a Windows C application and companion dynamic 
>> library. The exe needs to export
>> functions to the dll, and I have a def file which describes which ones.  
>> This is how I tried to do it:
>>
>>     gcc -mwindows -shared-libgcc -o dd.exe $(exeOBJ) $(exeLIBS)
>>
>>     dlltool -l libimp.a -d mydef.def $(exeOBJ)
>>
>>     gcc -shared -shared-libgcc -o jd.dll $(dllOBJ) -limp
>>
>> (Objects get generated in a separate "gcc -c" step)
>> Both the exe and dll build with no errors, but the application fails at 
>> runtime when the exe tries to execute
>> LoadLibrary(jd.dll).  This returns a Windows error code 193 
>> (ERROR_BAD_EXE_FORMAT).
>> If instead I build the dll with the "-mdll" flag instead of "-shared", 
>> it fails at the same spot, but with error 487
>> (ERROR_INVALID_ADDRESS)
>>
>> Two other things I've tried are:
>>
>>     ar libstatic.a $(exeOBJ)
>> and linking the dll to that, but this generates undefined symbol errors
>>
>> and even:
>>     gcc -shared -shared-libgcc -o jd.dll $(dllOBJ) dd.exe
>> which managed to crash the language driver.
>>
>>
>> I'm using make with Windows cmd, no MSYS. Can someone point me in the 
>> right direction?
>>     


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users