This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

DLL problem


Hi,

I recently installed Cygwin and tried to port a library,
which was compiled with gcc and g++, to a Windows dll.

I followed the steps described under 'Building and Using
DLLs' and used this script to generate the DLL:

cd driver
make -f driver.mak libdrv.a >& ../make_driver.log
cp libdrv.a ..
cd ../fransch
make -f fransch.mak >& ../make_fransch.log
cp libfransch.a ..
cd ..

gcc -c fs_driver_lib.c -Idriver -o fs_driver_lib.o

gcc -s -Wl,--base-file,fs_driver_lib.base -o fs_driver_lib.dll
fs_driver_lib.o -Wl,-e,_DllMain@12 -Wl,-e,_FS_Driver_run -Wl,libdrv.a
-Wl,libFransch.a -Wl,libstdc++.a
dlltool --base-file fs_driver_lib.base --def fs_driver_lib.def
--output-exp fs_driver_lib.exp --dllname fs_driver_lib.dll
gcc -s -Wl,--base-file,fs_driver_lib.base,fs_driver_lib.exp -o
fs_driver_lib.dll fs_driver_lib.o -Wl,-e,_DllMain@12
-Wl,-e,_FS_Driver_run -Wl,libdrv.a -Wl,libFransch.a -Wl,libstdc++.a
dlltool --base-file fs_driver_lib.base --def fs_driver_lib.def
--output-exp fs_driver_lib.exp
gcc -Wl,fs_driver_lib.exp -o fs_driver_lib.dll fs_driver_lib.o
-Wl,-e,_DllMain@12 -Wl,-e,_FS_Driver_run -Wl,libdrv.a -Wl,libFransch.a
-Wl,libstdc++.a

Compilation and linking works without warnings.
The corresponding fs_driver_lib.lib is generated
as follows:

lib  /machine:ix86 /DEF:fs_driver_lib.def

and used in a VC++ 6.0 project to be linked against an other
DLL (FS_Driver), which in turn is called from Simulink.
DLL loading works fine, but when actually calling the exported
function, a segmentation violation is detected (see below).

It seems to be related to file I/O and print statements, but I can't
say for sure.

I've looked all over the FAQ and tried a lot of compiler and linker
switches, but without avail.

Has anybody an idea?

Does the commercial version cover such kind of support?


Best regards,

  Thiess



------------------------------------------------------------------------
       Segmentation violation detected at Wed Apr 12 19:56:01 2000
------------------------------------------------------------------------

Configuration:
  MATLAB Version:   5.3.1.29215a (R11.1)
  Operating System: Microsoft Windows 98
  Window System:    Version 4.10 (Build 2222:  A )

Register State:
  EAX = 00000000  EBX = 610625bc
  ECX = 61062380  EDX = 00000000
  ESI = 61064944  EDI = 01b37108
  EBP = 01b36c20  ESP = 01b36c14
  EIP = bff7b9a6  FLG = 00000246

Stack Trace:
  [0] KERNEL32.DLL:bff7b9a6(0x61062380, 0x610625bc, 0, 0x01b37108)
  [1] CYGWIN1.DLL:6105aa0d(0x61062380, 1024, 0x610625bc, 0x01b37020)
  [2] CYGWIN1.DLL:6105ebaa(0x610625bc, 0x08551040, 0x01b36f58,
0x6105851b)
  [3] CYGWIN1.DLL:6105b3b7(0x610625bc, 0x08551040, 0x01b37020,
0x01b37108)
  [4] CYGWIN1.DLL:6105851b(0x61062380, 0x610625bc, 0x08551040,
0x01b36f94)
  [5] CYGWIN1.DLL:6105845c(0x610625bc, 0x08551040, 0x01b36f94,
0x06d8d0f8)
  [6] CYGWIN1.DLL:61053f31(0x08551040, 0, 0x81708050, 0x8170800c)
  [7] FS_DRIVER_LIB.DLL:08551068(0x01b370e4, 0x83c46f74, 0, 0)
  [8] FS_DRIVER_LIB.DLL:08551259(0, 0x01b370e4, 0, 0)
  [9] FS_DRIVER.DLL:08512cc2(0x04e42fa8, 0, 0x06d8cf18, 0)
  [10] FS_DRIVER.DLL:085128e3(0xfffffffe, 0x04d6c270, 5, 0x06d8cf18)
  [11] MATLAB.EXE:_mexRunMexFile(0xffff127f, 0x04d6c270, 5, 0x06d8cf18)
+ 95 bytes
  [12] MATLAB.EXE:_psRunMexFile(0xfffffffe, 0x04d6c270, 5, 0x06d8cf18) +
458 bytes
  [13] MATLAB.EXE:_psCallMexFile(0xfffffffe, 0x04d6c270, 5, 0x06d8cf18)
+ 28 bytes
  [14] MATLAB.EXE:_psCallFunction(0xfffffffe, 0x04d6c270, 5, 0x06d8cf18)
+ 45 bytes
  [15] MATLAB.EXE:_psDoMatlabFcnCall(0xfffffffe, 0x04d6c270, 5,
0x06d8cf18) + 151 bytes
  [16] SIMULINK.DLL:_CMexSFcnOutputFcn(0x04d6bf38, 0x04cd34c0,
0x01b373ec, 0x007e5f77) + 571 bytes
  [17] SIMULINK.DLL:_ModelOutput(0x04d6bf38, 0x04d63710, 0x0467f8b0, 0)
+ 40 bytes
  [18] SIMULINK.DLL:_SFcnOutputFcn(0x04cd34c0, 0x06da586c, 0x0467f8b0,
0x04e150b4) + 247 bytes
  [19] SIMULINK.DLL:_BlockOutput(0x06da586c, 0x0467f8b0, 0x04d63710, 0)
+ 683 bytes
  [20] SIMULINK.DLL:_ExecSTaskOutputList(0x04d63710, 0x04dcd0a0,
0x04e150b4, 0) + 259 bytes
  [21] SIMULINK.DLL:_BdSystemOutput(0x0467f8b0, 0x02804278, 0x04dcd0a0,
0x0467f8b0) + 124 bytes
  [22] SIMULINK.DLL:_BdOutputFcn(0x04d63710, 0, 0x01b374d8, 0x00849af4)
+ 35 bytes
  [23] SIMULINK.DLL:_ModelOutput(0x04d63710, 0x04d63710, 0x0467f8b0, 0)
+ 40 bytes
  [24] SIMULINK.DLL:_slDoOutputAndUpdate(0, 0x026f8c28, 0x04d63710, 0) +
244 bytes
  [25] SIMULINK.DLL:_SimulateModel(1, 0x026f8c28, 0x01b3757c,
0x00a1df08) + 128 bytes
  [26] SIMULINK.DLL:_Simulate(0x01b3758c, 0x01b37588, 0, 3) + 497 bytes
  [27] SIMULINK.DLL:_sleCommandLineSimulation(0, 0x01b375d4, 3,
0x01b3789c) + 133 bytes
  [28] SIMULINK.DLL:_slFullSimulate(0, 0x01b375d4, 3, 0x01b3789c) + 26
bytes
  [29] MATLAB.EXE:_psStackOp(1, 3, 0, 0x01b39570) + 1194 bytes
  [30] MATLAB.EXE:_psInterPcode(1, 0x06d466b8, 2, 0) + 2180 bytes
  [31] MATLAB.EXE:_psInterPcode(1, 0, 0x026de848, 0) + 4441 bytes
  [32] MATLAB.EXE:_psWordsj(0, 0x01b39880, 0, 0x01b39b4c) + 1171 bytes
  [33] MATLAB.EXE:_psCallMFile(0, 0x01b39880, 0, 0x01b39b4c) + 170 bytes
  [34] MATLAB.EXE:_psCallFunction(0, 0x01b39880, 0, 0x01b39b4c) + 45
bytes
  [35] MATLAB.EXE:_psFullFevalFcn(0, 0x01b39880, 1, 0x01b39b48) + 201
bytes
  [36] MATLAB.EXE:_psStackOp(103, 1, 0, 0) + 1194 bytes
  [37] MATLAB.EXE:_psInterPcode(1, 0, 0x026dfcf8, 0) + 2426 bytes
  [38] MATLAB.EXE:_psWordsj(0, 0x01b3adec, 0, 0x01b3b0f8) + 1171 bytes
  [39] MATLAB.EXE:_psExecMFile(0, 0, 0x01b3b0f8, 0x026dfcf8) + 189 bytes
  [40] MATLAB.EXE:_psExecFunction(0, 0, 0x01b3b0f8, 0x026dfcf8) + 41
bytes
  [41] MATLAB.EXE:_psMMexExecute(685, 0, 0, 0x01b3cd18) + 611 bytes
  [42] MATLAB.EXE:_psInterPcode(1, 0, 2, 3) + 1678 bytes
  [43] MATLAB.EXE:_psInterPcode(1, 1, 0x026d95d8, 0) + 4441 bytes
  [44] MATLAB.EXE:_psWordsj(0, 0x01b3d028, 1, 0x01b3d2f4) + 1171 bytes
  [45] MATLAB.EXE:_psCallMFile(0, 0x01b3d028, 1, 0x01b3d2f4) + 170 bytes
  [46] MATLAB.EXE:_psCallFunction(0, 0x01b3d028, 1, 0x01b3d2f4) + 45
bytes
  [47] MATLAB.EXE:_psFullFevalFcn(0, 0x01b3d028, 2, 0x01b3d2f0) + 201
bytes
  [48] MATLAB.EXE:_psStackOp(103, 2, 0, 2) + 1194 bytes
  [49] MATLAB.EXE:_psInterPcode(0, 0x04d8c79a, 0, 0x02584a00) + 2426
bytes
  [50] MATLAB.EXE:_psEvalString(0x04d8c780, 25, 0, 0) + 537 bytes
  [51] MATLAB.EXE:_psEvalExpInWS(0x04d8c780, 0, 0, 0x01b3e3f8) + 94
bytes
  [52] HG.DLL:_goCallEventCallback(0, 0, 0x0074d7bc, 0x006fbcc0) + 321
bytes
  [53] HG.DLL:_goCallCallback(0x026e95a8, 0x04ad40e8, 0x0074d7bc,
0x006fbcc0) + 66 bytes
  [54] HG.DLL:_goControlActivated(0x026e95a8, 4056, 0x04ad4148,
0x01b3e6d0) + 80 bytes
  [55] UIW.DLL:_activate_control(4056, 0x04ad4148, 0x01b3e4e0, 34128) +
137 bytes
  [56] UIW.DLL:_PushButtonProc@16(4056, 0, 0, 4056) + 127 bytes
  [57] KERNEL32.DLL:bff7363b(0x66c78550, 26311, 0, 0xbff719b8)
  [58] KERNEL32.DLL:bff94407(0x84e66038, 0xbff7186d, 0x852a500f, 0)


Segmentation violation occurred within signal handler.
Unable to complete stack trace (stack was probably corrupted)

This error was detected while a MEX-file was running.  If the MEX-file
is not an official MathWorks function, please examine its source code
for errors.  Please consult the MATLAB API Guide for information on
debugging MEX-files.

-- 
-------------------------------------------------------------
Dipl.-Ing. Thieß-Magnus Wolter          Tel: +49 89 747377 33
TESIS DYNAware GmbH                     Fax: +49 89 747377 99
Implerstraße 26
D-81371 München, Germany                    t.wolter@tesis.de
-------------------------------------------------------------


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]