From: colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp (Colin Peters) Subject: RE: Making cygnus-win32 libraries from DLLs 31 Aug 1997 06:53:56 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <01BCB3A8.5EED0300.cygnus.gnu-win32@gbird0> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="---- =_NextPart_000_01BCB3A8.5EF62AC0" Original-To: "'Chris Kirgios'" Original-Cc: "'GNU-Win32'" Original-Sender: owner-gnu-win32 AT cygnus DOT com ------ =_NextPart_000_01BCB3A8.5EF62AC0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Chris Kirgios[SMTP:ckirgios AT ajboggs DOT com] wrote: >I have a similar problem with Minh Le Cong to whom you replied in the = cygnus mailing list. I have ported all my C++ code from Solaris to = Windows NT with the exception of a library that uses Oracle Pro*C/C++ = (embedded SQL). Modules that link with this library must link with an = Oracle dll. Question: How do I link my g++ linked code with that = library/dll?=20 > >I am an NT 'ignorant' so I appreciate all the help and input I can get. I have heard a few people ask this question, so I dug around a bit in my files and found out that the program best suited for this is not really dumpexts (that works with object files) but one posted by Ismael Jurado way back in April called impdef. I've included the source code and will put up the source and exe on my web site shortly. This program compiles and works on my system with no modifications = (since it includes the missing info from the winnt.h header than dumpexts does not). Anyway, here's how it works. Assuming you have a .dll and the appropriate .h files (you don't = actually need the .lib at all) run impdef on the .dll: impdef foo.dll >foo.def Then run foo.def through dlltool to get a libfoo.a file: dlltool --dllname foo.dll --def foo.def --output-lib libfoo.a -k NOTE: Don't let the --dllname argument fool you. Dlltool does NOT look for any file called foo.dll and definitely does NOT extract the exports and create the right library for them. You need impdef. The dllname is just the name that is put into the library to mark what file should be loaded to resolve the imports (don't put a path name in here, just the basic file name). Compile your code including the .h files and linking with the libfoo.a library. Your code, upon execution, will search for foo.dll and resolve the references to the functions within it (if all goes well). That's it, good luck. Colin. PS. Apologies to earlier inquirers, including Minh Le Cong, who were told that dumpexts didn't do the job I thought it would. It doesn't, but impdef does. =20 -- Colin Peters - Saga Univ. Dept. of Information Science -- colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp - finger for PGP public key -- http://www.fu.is.saga-u.ac.jp/~colin/index.html -- http://www.geocities.com/Tokyo/Towers/6162/ ------ =_NextPart_000_01BCB3A8.5EF62AC0 Content-Type: application/octet-stream; name="impdef.cpp" Content-Transfer-Encoding: base64 Ly89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQovLyBUaGlzIGlzIGEgbW9kaWZp Y2F0aW9uIG9mOg0KLy8gICBQRURVTVAgLSBNYXR0IFBpZXRyZWsgMTk5NQ0KLy8gZG9uZSBieSBJ c21hZWwgSnVyYWRvIDE5OTcNCi8vDQovLyBUaGlzIHByb2dyYW0gb25seSBvdXRwdXRzIHRvIHN0 ZG91dCBhIERFRiBmaWxlIGZyb20gYSBETEwgZ2l2ZW4gaW4gdGhlDQovLyBjb21tYW5kIGxpbmUu DQovLyBJIGRvbrR0IGtub3cgaG93IHRvIGNvbnRhY3QgTWF0dCwgc28gaWYgdGhpcyBwcm9ncmFt IGlzIG5vdCBsZWdhbCwgcGxlYXNlDQovLyBsZXQgbWUga25vdy4NCi8vICAgIGlzbWFlbGpAaG90 bWFpbC5jb20NCi8vPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KDQojaW5jbHVk ZSA8d2luZG93cy5oPg0KI2luY2x1ZGUgPHN0ZGlvLmg+DQoNCi8vIFRoaXMgY29kZSB3YXMgdGFr ZW4gZnJvbSBXSU5OVC5ILCB3aGljaCBpcyBub3QgaW5jbHVkZWQgaW4gdGhlIGN1cnJlbnQNCi8v IEN5Z251cyBwb3J0Lg0KI2lmbmRlZiBfV0lOTlRfDQojZGVmaW5lIEZJRUxEX09GRlNFVCh0eXBl LCBmaWVsZCkgICAgKChMT05HKSYoKCh0eXBlICopMCktPmZpZWxkKSkNCiNkZWZpbmUgSU1BR0Vf RklSU1RfU0VDVElPTiggbnRoZWFkZXIgKSAoKFBJTUFHRV9TRUNUSU9OX0hFQURFUikgICAgICAg IFwNCiAgICAoKERXT1JEKW50aGVhZGVyICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIFwNCiAgICAgRklFTERfT0ZGU0VUKCBJTUFHRV9OVF9IRUFERVJT LCBPcHRpb25hbEhlYWRlciApICsgICAgICAgICAgICAgICAgIFwNCiAgICAgKChQSU1BR0VfTlRf SEVBREVSUykobnRoZWFkZXIpKS0+RmlsZUhlYWRlci5TaXplT2ZPcHRpb25hbEhlYWRlciAgIFwN CiAgICApKQ0KDQojZGVmaW5lIElNQUdFX1NJWkVPRl9TSE9SVF9OQU1FICAgICAgICAgICAgICA4 DQojZGVmaW5lIElNQUdFX0RJUkVDVE9SWV9FTlRSWV9FWFBPUlQgICAgICAgICAwICAgLy8gRXhw b3J0IERpcmVjdG9yeQ0KI2RlZmluZSBJTUFHRV9OVU1CRVJPRl9ESVJFQ1RPUllfRU5UUklFUyAg ICAxNg0KI2RlZmluZSBJTUFHRV9OVF9TSUdOQVRVUkUgICAgICAgICAgICAgICAgICAweDAwMDA0 NTUwICAvLyBQRTAwDQojZGVmaW5lIElNQUdFX0RPU19TSUdOQVRVUkUgICAgICAgICAgICAgICAg IDB4NUE0RCAgICAgIC8vIE1aDQoNCnR5cGVkZWYgc3RydWN0IF9JTUFHRV9EQVRBX0RJUkVDVE9S WSB7DQogICAgRFdPUkQgICBWaXJ0dWFsQWRkcmVzczsNCiAgICBEV09SRCAgIFNpemU7DQp9IElN QUdFX0RBVEFfRElSRUNUT1JZLCAqUElNQUdFX0RBVEFfRElSRUNUT1JZOw0KDQp0eXBlZGVmIHN0 cnVjdCBfSU1BR0VfRklMRV9IRUFERVIgew0KICAgIFdPUkQgICAgTWFjaGluZTsNCiAgICBXT1JE ICAgIE51bWJlck9mU2VjdGlvbnM7DQogICAgRFdPUkQgICBUaW1lRGF0ZVN0YW1wOw0KICAgIERX T1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gIC8vIERPUyAuRVhFIGhlYWRlcg0KICAgIFdPUkQgICBlX21hZ2ljOyAg ICAgICAgICAgICAgICAgICAgIC8vIE1hZ2ljIG51bWJlcg0KICAgIFdPUkQgICBlX2NibHA7ICAg ICAgICAgICAgICAgICAgICAgIC8vIEJ5dGVzIG9uIGxhc3QgcGFnZSBvZiBmaWxlDQogICAgV09S RCAgIGVfY3A7ICAgICAgICAgICAgICAgICAgICAgICAgLy8gUGFnZXMgaW4gZmlsZQ0KICAgIFdP UkQgICBlX2NybGM7ICAgICAgICAgICAgICAgICAgICAgIC8vIFJlbG9jYXRpb25zDQogICAgV09S RCAgIGVfY3BhcmhkcjsgICAgICAgICAgICAgICAgICAgLy8gU2l6ZSBvZiBoZWFkZXIgaW4gcGFy YWdyYXBocw0KICAgIFdPUkQgICBlX21pbmFsbG9jOyAgICAgICAgICAgICAgICAgIC8vIE1pbmlt dW0gZXh0cmEgcGFyYWdyYXBocyBuZWVkZWQNCiAgICBXT1JEICAgZV9tYXhhbGxvYzsgICAgICAg ICAgICAgICAgICAvLyBNYXhpbXVtIGV4dHJhIHBhcmFncmFwaHMgbmVlZGVkDQogICAgV09SRCAg IGVfc3M7ICAgICAgICAgICAgICAgICAgICAgICAgLy8gSW5pdGlhbCAocmVsYXRpdmUpIFNTIHZh bHVlDQogICAgV09SRCAgIGVfc3A7ICAgICAgICAgICAgICAgICAgICAgICAgLy8gSW5pdGlhbCBT UCB2YWx1ZQ0KICAgIFdPUkQgICBlX2NzdW07ICAgICAgICAgICAgICAgICAgICAgIC8vIENoZWNr c3VtDQogICAgV09SRCAgIGVfaXA7ICAgICAgICAgICAgICAgICAgICAgICAgLy8gSW5pdGlhbCBJ UCB2YWx1ZQ0KICAgIFdPUkQgICBlX2NzOyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEluaXRp YWwgKHJlbGF0aXZlKSBDUyB2YWx1ZQ0KICAgIFdPUkQgICBlX2xmYXJsYzsgICAgICAgICAgICAg ICAgICAgIC8vIE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5USGVhZGVyLT5TaWduYXR1cmUgIT0gSU1BR0VfTlRfU0lHTkFUVVJF ICkNCiAgICAgICAgew0KICAgICAgICAgICAgcHJpbnRmKCJOb3QgYSBQb3J0YWJsZSBFeGVjdXRh YmxlIChQRSkgRVhFXG4iKTsNCiAgICAgICAgICAgIHJldHVybjsNCiAgICAgICAgfQ0KLy8gICAg fQ0KLyoNCiAgICBfX2V4Y2VwdCggVFJVRSApICAgIC8vIFNob3VsZCBvbmx5IGdldCBoZXJlIGlm IHBOVEhlYWRlciAoYWJvdmUpIGlzIGJvZ3VzDQogICAgew0KICAgICAgICBwcmludGYoICJpbnZh bGlkIC5FWEVcbiIpOw0KICAgICAgICByZXR1cm47DQogICAgfQ0KKi8NCiAgICBEdW1wRXhwb3J0 c1NlY3Rpb24oYmFzZSwgcE5USGVhZGVyKTsNCiAgICBwcmludGYoIlxuIik7DQp9DQoNCnZvaWQg RHVtcEZpbGUoTFBTVFIgZmlsZW5hbWUpDQp7DQogICAgSEFORExFIGhGaWxlOw0KICAgIEhBTkRM RSBoRmlsZU1hcHBpbmc7DQogICAgTFBWT0lEIGxwRmlsZUJhc2U7DQogICAgUElNQUdFX0RPU19I RUFERVIgZG9zSGVhZGVyOw0KICAgIA0KICAgIGhGaWxlID0gQ3JlYXRlRmlsZShmaWxlbmFtZSwg R0VORVJJQ19SRUFELCBGSUxFX1NIQVJFX1JFQUQsIE5VTEwsDQogICAgICAgICAgICAgICAgICAg ICAgICBPUEVOX0VYSVNUSU5HLCBGSUxFX0FUVFJJQlVURV9OT1JNQUwsIDApOw0KDQogICAgaWYg KCBoRmlsZSA9PSBJTlZBTElEX0hBTkRMRV9WQUxVRSApDQogICAgew0KICAgICAgICBwcmludGYo IkNvdWxkbid0IG9wZW4gZmlsZSB3aXRoIENyZWF0ZUZpbGUoKVxuIik7DQogICAgICAgIHJldHVy bjsNCiAgICB9DQoNCiAgICBoRmlsZU1hcHBpbmcgPSBDcmVhdGVGaWxlTWFwcGluZyhoRml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NPRkYgRVhFL09CSi9MSUIgZmlsZSBkdW1wZXIgLSAxOTk1IE1h dHQgUGlldHJla1xuIg0KImJ5IElzbWFlbCBKdXJhZG8gMTk5Ny4gT25seSBwcm9kdWNlcyBhIERF RiBmaWxlIGZyb20gYSBETExcbiINCiJMZXQgbWUga25vdyBpZiB0aGlzIG1vZGlmaWNhdGlvbiBp cyBub3QgbGVnYWw6IGlzbWFlbGpAaG90bWFpbC5jb20iOw0KDQppbnQgbWFpbihpbnQgYXJnYywg Y2hhciAqYXJndltdKSB7DQogIGlmICggYXJnYyA9PSAxICkgew0KICAgIHByaW50ZiggSGVscFRl eHQgKTsNCiAgICByZXR1cm4gMTsNCiAgfQ0KICBEdW1wRmlsZShhcmd2WzFdKTsNCiAgcmV0dXJu IDA7DQp9DQo= ------ =_NextPart_000_01BCB3A8.5EF62AC0-- - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".