From: Maarten v. Es <maa...@uc...> - 2009-08-14 10:23:17
|
Marc Vaillant wrote: > On Tue, Aug 11, 2009 at 05:47:11PM +0100, Maarten van Es wrote: >> Hi all, >> >> I have been trying to get a project to work with mingw for 2 full days >> now, but so far I have consistently run into the same problem. Maybe >> someone here has an idea how to solve my problem? >> >> I am trying to use mingw to compile a dll which is to be used by a >> commercial scientific analysis program: Igor (sold by WaveMetrics). >> WaveMetrics sells an additional package which allows programming a dll >> in C to add functionality to Igor. This package comes standard with a >> build system for various versions of MS Visual c++ for windows (plus 2 >> build systems for MAC). There is a number of support routines in c plus >> a binary file "Igor.lib" with emulation for a few MAC-specific functions >> and call-backs into Igor. There is also a number of example projects >> with source code. >> >> With a few minor modifications I can compile a sample project without >> problems. The dll is loaded by Igor and called successfully. One of the >> first things the support routines do is to call a function in IGOR.lib >> "HMODULE hModule = GetIgorModule();". Here the program crashes. > > So there's an MSVC program, Igor, which loads extension DLLs that you > can write yourself. You are trying to write an extension DLL using > mingw that also links to a static MSVC built library Igor.lib. Problems > happen when you try to call into Igor.lib from your mingw DLL. Is that > correct? Others will chime in but your problem may lie Igor.lib being > static. I would try a simple example that simulates your scenario, msvc > main program, msvc static lib, mingw dll. Is it possible to build > Igor.lib as a DLL? That will likely work if the functions in Igor.lib > are C and not C++. But you have bigger problems if what you are trying > to call in Igor.lib is C++. > > Marc Hi, That is a correct summary. In the meantime I have had help from someone else who did manage to get this to work. He supplied me with a different version of the .lib file: "As far as I can remember, it involved a couple of GNU tools to extract symbols and code from the windows .lib files, translate the calling signatures and rebuild them into a .a library." Thanks for your time Maarten |